summaryrefslogtreecommitdiff
path: root/chromium/third_party/pdfium/xfa/fxfa/app
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/pdfium/xfa/fxfa/app')
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/DEPS3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp48
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp282
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h38
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp88
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h23
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp24
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h17
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp271
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp162
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp87
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp20
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp115
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp441
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp60
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp850
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp31
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp26
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp468
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp74
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp36
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp29
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h15
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp2050
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp1523
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp533
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp2055
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp32
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp70
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h2
61 files changed, 511 insertions, 9148 deletions
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/DEPS b/chromium/third_party/pdfium/xfa/fxfa/app/DEPS
index 5c72d1d0b2e..f722184c917 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/DEPS
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/DEPS
@@ -1,6 +1,3 @@
include_rules = [
'+core/fdrm/crypto',
- '+core/fpdfapi/font',
- '+core/fpdfapi/page',
- '+core/fpdfdoc',
]
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp
deleted file mode 100644
index bcce7219bc3..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 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/fxfa/cxfa_eventparam.h"
-
-#include "xfa/fxfa/fxfa.h"
-
-CXFA_EventParam::CXFA_EventParam()
- : m_pTarget(nullptr),
- m_eType(XFA_EVENT_Unknown),
- m_bCancelAction(false),
- m_iCommitKey(0),
- m_bKeyDown(false),
- m_bModifier(false),
- m_bReenter(false),
- m_iSelEnd(0),
- m_iSelStart(0),
- m_bShift(false),
- m_bIsFormReady(false),
- m_iValidateActivities(XFA_VALIDATE_preSubmit) {}
-
-CXFA_EventParam::~CXFA_EventParam() {}
-
-CXFA_EventParam::CXFA_EventParam(const CXFA_EventParam& other) = default;
-
-void CXFA_EventParam::Reset() {
- m_wsChange.clear();
- m_bCancelAction = false;
- m_iCommitKey = 0;
- m_wsFullText.clear();
- m_bKeyDown = false;
- m_bModifier = false;
- m_wsNewContentType.clear();
- m_wsNewText.clear();
- m_wsPrevContentType.clear();
- m_wsPrevText.clear();
- m_bReenter = false;
- m_iSelEnd = 0;
- m_iSelStart = 0;
- m_bShift = false;
- m_wsSoapFaultCode.clear();
- m_wsSoapFaultString.clear();
- m_bIsFormReady = false;
- m_iValidateActivities = XFA_VALIDATE_preSubmit;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp
index 4128cd88220..d657b285395 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
-CXFA_LinkUserData::CXFA_LinkUserData(FX_WCHAR* pszText)
+CXFA_LinkUserData::CXFA_LinkUserData(wchar_t* pszText)
: m_wsURLContent(pszText) {}
CXFA_LinkUserData::~CXFA_LinkUserData() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h
index 852b4676483..a3ccd927124 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h
@@ -17,10 +17,10 @@ class CXFA_LinkUserData : public CFX_Retainable {
template <typename T, typename... Args>
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- const FX_WCHAR* GetLinkURL() const { return m_wsURLContent.c_str(); }
+ const wchar_t* GetLinkURL() const { return m_wsURLContent.c_str(); }
- protected:
- explicit CXFA_LinkUserData(FX_WCHAR* pszText);
+ private:
+ explicit CXFA_LinkUserData(wchar_t* pszText);
~CXFA_LinkUserData() override;
CFX_WideString m_wsURLContent;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp
index 0733c52dfcc..2ac58ba07a1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp
@@ -14,8 +14,8 @@ CXFA_LoaderContext::CXFA_LoaderContext()
m_fStartLineOffset(0),
m_iChar(0),
m_iTotalLines(-1),
+ m_dwFlags(0),
m_pXMLNode(nullptr),
- m_pNode(nullptr),
- m_dwFlags(0) {}
+ m_pNode(nullptr) {}
CXFA_LoaderContext::~CXFA_LoaderContext() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h
index d8ccdbe7e27..16d9608bace 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h
@@ -22,19 +22,19 @@ class CXFA_LoaderContext {
~CXFA_LoaderContext();
bool m_bSaveLineHeight;
- FX_FLOAT m_fWidth;
- FX_FLOAT m_fHeight;
- FX_FLOAT m_fLastPos;
- FX_FLOAT m_fStartLineOffset;
+ float m_fWidth;
+ float m_fHeight;
+ float m_fLastPos;
+ float m_fStartLineOffset;
int32_t m_iChar;
int32_t m_iLines;
int32_t m_iTotalLines;
+ uint32_t m_dwFlags;
CFDE_XMLNode* m_pXMLNode;
CXFA_Node* m_pNode;
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
- CFX_ArrayTemplate<FX_FLOAT> m_lineHeights;
- uint32_t m_dwFlags;
- std::vector<FX_FLOAT> m_BlocksHeight;
+ std::vector<float> m_lineHeights;
+ std::vector<float> m_BlocksHeight;
};
#endif // XFA_FXFA_APP_CXFA_LOADERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h
index 3e6bb99876a..87f71fc1924 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h
@@ -20,7 +20,7 @@ class CXFA_PieceLine {
~CXFA_PieceLine();
std::vector<std::unique_ptr<XFA_TextPiece>> m_textPieces;
- CFX_ArrayTemplate<int32_t> m_charCounts;
+ std::vector<int32_t> m_charCounts;
};
#endif // XFA_FXFA_APP_CXFA_PIECELINE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp
index 06cbfe0c70b..880bdf45852 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -11,12 +11,15 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+#include "xfa/fde/cfde_brush.h"
#include "xfa/fde/cfde_path.h"
+#include "xfa/fde/cfde_pen.h"
+#include "xfa/fde/cfde_renderdevice.h"
#include "xfa/fde/css/cfde_csscomputedstyle.h"
#include "xfa/fde/css/cfde_cssstyleselector.h"
-#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fde/fde_object.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
#include "xfa/fxfa/app/cxfa_loadercontext.h"
#include "xfa/fxfa/app/cxfa_pieceline.h"
@@ -26,8 +29,8 @@
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/app/xfa_textpiece.h"
#include "xfa/fxfa/parser/cxfa_font.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_para.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001
@@ -78,8 +81,7 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
if (pXMLChild->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
- CFX_WideString wsTag;
- pXMLElement->GetLocalTagName(wsTag);
+ CFX_WideString wsTag = pXMLElement->GetLocalTagName();
if (wsTag == L"body" || wsTag == L"html") {
pXMLContainer = pXMLChild;
break;
@@ -90,9 +92,9 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
}
std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) {
- uint32_t dwStyle = FX_RTFLAYOUTSTYLE_ExpandTab;
+ uint32_t dwStyle = FX_LAYOUTSTYLE_ExpandTab;
if (!bDefault)
- dwStyle |= FX_RTFLAYOUTSTYLE_Pagination;
+ dwStyle |= FX_LAYOUTSTYLE_Pagination;
auto pBreak = pdfium::MakeUnique<CFX_RTFBreak>(dwStyle);
pBreak->SetLineBreakTolerance(1);
@@ -101,11 +103,11 @@ std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) {
return pBreak;
}
-void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
+void CXFA_TextLayout::InitBreak(float fLineWidth) {
CXFA_Font font = m_pTextProvider->GetFontNode();
CXFA_Para para = m_pTextProvider->GetParaNode();
- FX_FLOAT fStart = 0;
- FX_FLOAT fStartPos = 0;
+ float fStart = 0;
+ float fStartPos = 0;
if (para) {
CFX_RTFLineAlignment iAlign = CFX_RTFLineAlignment::Left;
switch (para.GetHorizontalAlign()) {
@@ -135,7 +137,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
fLineWidth = fStart;
fStartPos = fStart;
- FX_FLOAT fIndent = para.GetTextIndent();
+ float fIndent = para.GetTextIndent();
if (fIndent > 0)
fStartPos += fIndent;
}
@@ -148,7 +150,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
m_pBreak->SetCharSpace(font.GetLetterSpacing());
}
- FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr);
+ float fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr);
m_pBreak->SetFontSize(fFontSize);
m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr));
m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
@@ -156,7 +158,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
- FX_FLOAT fLineWidth,
+ float fLineWidth,
CFDE_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle) {
if (!pStyle) {
@@ -185,7 +187,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
}
m_pBreak->SetAlignment(iAlign);
- FX_FLOAT fStart = 0;
+ float fStart = 0;
const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
const FDE_CSSRect* pPaddingRect = pStyle->GetPaddingWidth();
if (pRect) {
@@ -215,7 +217,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
}
}
m_pBreak->SetLineBoundary(fStart, fLineWidth);
- FX_FLOAT fIndent = pStyle->GetTextIndent().GetValue();
+ float fIndent = pStyle->GetTextIndent().GetValue();
if (fIndent > 0)
fStart += fIndent;
@@ -224,13 +226,10 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
if (!m_pTabstopContext)
m_pTabstopContext = pdfium::MakeUnique<CXFA_TextTabstopsContext>();
m_textParser.GetTabstops(pStyle, m_pTabstopContext.get());
- for (int32_t i = 0; i < m_pTabstopContext->m_iTabCount; i++) {
- XFA_TABSTOPS* pTab = m_pTabstopContext->m_tabstops.GetDataPtr(i);
- m_pBreak->AddPositionedTab(pTab->fTabstops);
- }
+ for (const auto& stop : m_pTabstopContext->m_tabstops)
+ m_pBreak->AddPositionedTab(stop.fTabstops);
}
-
- FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle);
+ float fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle);
m_pBreak->SetFontSize(fFontSize);
m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, pStyle));
@@ -248,12 +247,11 @@ int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) {
return wsText.GetLength();
}
-FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
+float CXFA_TextLayout::GetLayoutHeight() {
if (!m_pLoader)
return 0;
- int32_t iCount = m_pLoader->m_lineHeights.GetSize();
- if (iCount == 0 && m_pLoader->m_fWidth > 0) {
+ if (m_pLoader->m_lineHeights.empty() && m_pLoader->m_fWidth > 0) {
CFX_SizeF szMax(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
CFX_SizeF szDef;
m_pLoader->m_bSaveLineHeight = true;
@@ -263,23 +261,23 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
return szDef.height;
}
- FX_FLOAT fHeight = m_pLoader->m_fHeight;
+ float fHeight = m_pLoader->m_fHeight;
if (fHeight < 0.1f) {
fHeight = 0;
- for (int32_t i = 0; i < iCount; i++)
- fHeight += m_pLoader->m_lineHeights.ElementAt(i);
+ for (float value : m_pLoader->m_lineHeights)
+ fHeight += value;
}
return fHeight;
}
-FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) {
+float CXFA_TextLayout::StartLayout(float fWidth) {
if (!m_pLoader)
m_pLoader = pdfium::MakeUnique<CXFA_LoaderContext>();
- if (fWidth < 0 || (m_pLoader->m_fWidth > -1 &&
- FXSYS_fabs(fWidth - m_pLoader->m_fWidth) > 0)) {
- m_pLoader->m_lineHeights.RemoveAll();
- m_Blocks.RemoveAll();
+ if (fWidth < 0 ||
+ (m_pLoader->m_fWidth > -1 && fabs(fWidth - m_pLoader->m_fWidth) > 0)) {
+ m_pLoader->m_lineHeights.clear();
+ m_Blocks.clear();
Unload();
m_pLoader->m_fStartLineOffset = 0;
}
@@ -298,14 +296,14 @@ FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) {
}
bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
- FX_FLOAT& fCalcHeight,
- FX_FLOAT fContentAreaHeight,
- FX_FLOAT fTextHeight) {
+ float& fCalcHeight,
+ float fContentAreaHeight,
+ float fTextHeight) {
if (!m_pLoader)
return false;
- int32_t iBlockCount = m_Blocks.GetSize();
- FX_FLOAT fHeight = fTextHeight;
+ int32_t iBlockCount = pdfium::CollectionSize<int32_t>(m_Blocks);
+ float fHeight = fTextHeight;
if (fHeight < 0)
fHeight = GetLayoutHeight();
@@ -326,14 +324,13 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
}
}
- FX_FLOAT fLinePos = m_pLoader->m_fStartLineOffset;
+ float fLinePos = m_pLoader->m_fStartLineOffset;
int32_t iLineIndex = 0;
if (iBlockCount > 1) {
if (iBlockCount >= (iBlockIndex + 1) * 2) {
- iLineIndex = m_Blocks.ElementAt(iBlockIndex * 2);
+ iLineIndex = m_Blocks[iBlockIndex * 2];
} else {
- iLineIndex = m_Blocks.ElementAt(iBlockCount - 1) +
- m_Blocks.ElementAt(iBlockCount - 2);
+ iLineIndex = m_Blocks[iBlockCount - 1] + m_Blocks[iBlockCount - 2];
}
if (!m_pLoader->m_BlocksHeight.empty()) {
for (int32_t i = 0; i < iBlockIndex; i++)
@@ -341,21 +338,21 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
}
}
- int32_t iCount = m_pLoader->m_lineHeights.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_pLoader->m_lineHeights);
int32_t i = 0;
for (i = iLineIndex; i < iCount; i++) {
- FX_FLOAT fLineHeight = m_pLoader->m_lineHeights.ElementAt(i);
- if ((i == iLineIndex) && (fLineHeight - fContentAreaHeight > 0.001)) {
+ float fLineHeight = m_pLoader->m_lineHeights[i];
+ if (i == iLineIndex && fLineHeight - fContentAreaHeight > 0.001) {
fCalcHeight = 0;
return true;
}
if (fLinePos + fLineHeight - fContentAreaHeight > 0.001) {
if (iBlockCount >= (iBlockIndex + 1) * 2) {
- m_Blocks.SetAt(iBlockIndex * 2, iLineIndex);
- m_Blocks.SetAt(iBlockIndex * 2 + 1, i - iLineIndex);
+ m_Blocks[iBlockIndex * 2] = iLineIndex;
+ m_Blocks[iBlockIndex * 2 + 1] = i - iLineIndex;
} else {
- m_Blocks.Add(iLineIndex);
- m_Blocks.Add(i - iLineIndex);
+ m_Blocks.push_back(iLineIndex);
+ m_Blocks.push_back(i - iLineIndex);
}
if (i == iLineIndex) {
if (fCalcHeight <= fLinePos) {
@@ -364,7 +361,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
(m_pLoader->m_BlocksHeight[iBlockIndex * 2] == iBlockIndex)) {
m_pLoader->m_BlocksHeight[iBlockIndex * 2 + 1] = fCalcHeight;
} else {
- m_pLoader->m_BlocksHeight.push_back((FX_FLOAT)iBlockIndex);
+ m_pLoader->m_BlocksHeight.push_back((float)iBlockIndex);
m_pLoader->m_BlocksHeight.push_back(fCalcHeight);
}
}
@@ -380,7 +377,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
}
int32_t CXFA_TextLayout::CountBlocks() const {
- int32_t iCount = m_Blocks.GetSize() / 2;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Blocks) / 2;
return iCount > 0 ? iCount : 1;
}
@@ -392,7 +389,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
defaultSize.width = 0xFFFF;
m_pBreak = CreateBreak(false);
- FX_FLOAT fLinePos = 0;
+ float fLinePos = 0;
m_iLines = 0;
m_fMaxWidth = 0;
Loader(defaultSize, fLinePos, false);
@@ -404,7 +401,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
return true;
}
-bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
+bool CXFA_TextLayout::Layout(const CFX_SizeF& size, float* fHeight) {
if (size.width < 1)
return false;
@@ -416,7 +413,7 @@ bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
}
m_iLines = 0;
- FX_FLOAT fLinePos = 0;
+ float fLinePos = 0;
Loader(size, fLinePos, true);
UpdateAlign(size.height, fLinePos);
m_pTabstopContext.reset();
@@ -433,10 +430,10 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
m_pLoader->m_iTotalLines = -1;
m_iLines = 0;
- FX_FLOAT fLinePos = 0;
+ float fLinePos = 0;
CXFA_Node* pNode = nullptr;
CFX_SizeF szText(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
- int32_t iCount = m_Blocks.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Blocks);
int32_t iBlocksHeightCount =
pdfium::CollectionSize<int32_t>(m_pLoader->m_BlocksHeight);
iBlocksHeightCount /= 2;
@@ -451,7 +448,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
m_pLoader->m_iChar = 0;
if (iCount > 1)
- m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock * 2 + 1);
+ m_pLoader->m_iTotalLines = m_Blocks[iBlock * 2 + 1];
Loader(szText, fLinePos, true);
if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f)
@@ -459,7 +456,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
} else if (m_pTextDataNode) {
iBlock *= 2;
if (iBlock < iCount - 2)
- m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock + 1);
+ m_pLoader->m_iTotalLines = m_Blocks[iBlock + 1];
m_pBreak->Reset();
if (m_bRichText) {
@@ -517,13 +514,14 @@ void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex) {
if (!m_pLoader)
return;
- int32_t iCountHeight = m_pLoader->m_lineHeights.GetSize();
+ int32_t iCountHeight =
+ pdfium::CollectionSize<int32_t>(m_pLoader->m_lineHeights);
if (iCountHeight == 0)
return;
bool bEndItem = true;
- int32_t iBlockCount = m_Blocks.GetSize();
- FX_FLOAT fLinePos = m_pLoader->m_fStartLineOffset;
+ int32_t iBlockCount = pdfium::CollectionSize<int32_t>(m_Blocks);
+ float fLinePos = m_pLoader->m_fStartLineOffset;
int32_t iLineIndex = 0;
if (iBlockIndex > 0) {
int32_t iBlockHeightCount =
@@ -540,18 +538,18 @@ void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex) {
int32_t i = 0;
for (i = iLineIndex; i < iCountHeight; i++) {
- FX_FLOAT fLineHeight = m_pLoader->m_lineHeights.ElementAt(i);
+ float fLineHeight = m_pLoader->m_lineHeights[i];
if (fLinePos + fLineHeight - rtText.height > 0.001) {
- m_Blocks.Add(iLineIndex);
- m_Blocks.Add(i - iLineIndex);
+ m_Blocks.push_back(iLineIndex);
+ m_Blocks.push_back(i - iLineIndex);
bEndItem = false;
break;
}
fLinePos += fLineHeight;
}
if (iCountHeight > 0 && (i - iLineIndex) > 0 && bEndItem) {
- m_Blocks.Add(iLineIndex);
- m_Blocks.Add(i - iLineIndex);
+ m_Blocks.push_back(iLineIndex);
+ m_Blocks.push_back(i - iLineIndex);
}
}
@@ -562,8 +560,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
if (!pFxDevice)
return false;
- std::unique_ptr<CFDE_RenderDevice> pDevice(
- new CFDE_RenderDevice(pFxDevice, false));
+ auto pDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pFxDevice, false);
pDevice->SaveState();
pDevice->SetClipRect(rtClip);
@@ -579,12 +576,12 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
int32_t iCharCount = 0;
int32_t iLineStart = 0;
int32_t iPieceLines = pdfium::CollectionSize<int32_t>(m_pieceLines);
- int32_t iCount = m_Blocks.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Blocks);
if (iCount > 0) {
iBlock *= 2;
if (iBlock < iCount) {
- iLineStart = m_Blocks.ElementAt(iBlock);
- iPieceLines = m_Blocks.ElementAt(iBlock + 1);
+ iLineStart = m_Blocks[iBlock];
+ iPieceLines = m_Blocks[iBlock + 1];
} else {
iPieceLines = 0;
}
@@ -605,7 +602,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
pCharPos = FX_Alloc(FXTEXT_CHARPOS, iChars);
iCharCount = iChars;
}
- FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS));
+ memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS));
RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos,
tmDoc2Device);
}
@@ -619,7 +616,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
return iPieceLines > 0;
}
-void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) {
+void CXFA_TextLayout::UpdateAlign(float fHeight, float fBottom) {
fHeight -= fBottom;
if (fHeight < 0.1f)
return;
@@ -641,7 +638,7 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) {
}
bool CXFA_TextLayout::Loader(const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces) {
GetTextDataNode();
if (!m_pTextDataNode)
@@ -665,12 +662,12 @@ bool CXFA_TextLayout::Loader(const CFX_SizeF& szText,
void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces) {
InitBreak(szText.width);
CXFA_Para para = m_pTextProvider->GetParaNode();
- FX_FLOAT fSpaceAbove = 0;
+ float fSpaceAbove = 0;
if (para) {
fSpaceAbove = para.GetSpaceAbove();
if (fSpaceAbove < 0.1f) {
@@ -693,13 +690,13 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
if (bRet && m_pLoader)
m_pLoader->m_pNode = pNode;
else
- EndBreak(CFX_RTFBreakType::Paragraph, fLinePos, bSavePieces);
+ EndBreak(CFX_BreakType::Paragraph, fLinePos, bSavePieces);
}
bool CXFA_TextLayout::LoadRichText(
CFDE_XMLNode* pXMLNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
bool bSavePieces,
CFX_RetainPtr<CXFA_LinkUserData> pLinkData,
@@ -713,7 +710,7 @@ bool CXFA_TextLayout::LoadRichText(
m_textParser.GetParseContextFromMap(pXMLNode);
FDE_CSSDisplay eDisplay = FDE_CSSDisplay::None;
bool bContentNode = false;
- FX_FLOAT fSpaceBelow = 0;
+ float fSpaceBelow = 0;
CFX_RetainPtr<CFDE_CSSComputedStyle> pStyle;
CFX_WideString wsName;
if (bEndBreak) {
@@ -729,7 +726,7 @@ bool CXFA_TextLayout::LoadRichText(
bContentNode = true;
} else if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pElement->GetLocalTagName(wsName);
+ wsName = pElement->GetLocalTagName();
}
if (wsName == L"ol") {
bIsOl = true;
@@ -759,9 +756,8 @@ bool CXFA_TextLayout::LoadRichText(
}
if (wsName == L"a") {
- CFX_WideString wsLinkContent;
ASSERT(pElement);
- pElement->GetString(L"href", wsLinkContent);
+ CFX_WideString wsLinkContent = pElement->GetString(L"href");
if (!wsLinkContent.IsEmpty()) {
pLinkData = pdfium::MakeRetain<CXFA_LinkUserData>(
wsLinkContent.GetBuffer(wsLinkContent.GetLength()));
@@ -775,7 +771,7 @@ bool CXFA_TextLayout::LoadRichText(
bContentNode ? pParentStyle.Get() : pStyle.Get());
CFX_WideString wsText;
if (bContentNode && iTabCount == 0) {
- static_cast<CFDE_XMLText*>(pXMLNode)->GetText(wsText);
+ wsText = static_cast<CFDE_XMLText*>(pXMLNode)->GetText();
} else if (wsName == L"br") {
wsText = L'\n';
} else if (wsName == L"li") {
@@ -856,7 +852,7 @@ bool CXFA_TextLayout::LoadRichText(
m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE;
}
if (bCurLi)
- EndBreak(CFX_RTFBreakType::Line, fLinePos, bSavePieces);
+ EndBreak(CFX_BreakType::Line, fLinePos, bSavePieces);
} else {
if (pContext)
eDisplay = pContext->GetDisplay();
@@ -864,9 +860,9 @@ bool CXFA_TextLayout::LoadRichText(
if (m_bBlockContinue) {
if (pContext && !bContentNode) {
- CFX_RTFBreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
- ? CFX_RTFBreakType::Paragraph
- : CFX_RTFBreakType::Piece;
+ CFX_BreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
+ ? CFX_BreakType::Paragraph
+ : CFX_BreakType::Piece;
EndBreak(dwStatus, fLinePos, bSavePieces);
if (eDisplay == FDE_CSSDisplay::Block) {
fLinePos += fSpaceBelow;
@@ -887,30 +883,29 @@ bool CXFA_TextLayout::LoadRichText(
}
bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
- FX_FLOAT& fLinePos,
- FX_FLOAT fSpaceAbove,
+ float& fLinePos,
+ float fSpaceAbove,
bool bSavePieces) {
- CFX_RTFBreakType dwStatus = CFX_RTFBreakType::None;
+ CFX_BreakType dwStatus = CFX_BreakType::None;
int32_t iChar = 0;
if (m_pLoader)
iChar = m_pLoader->m_iChar;
int32_t iLength = wsText.GetLength();
for (int32_t i = iChar; i < iLength; i++) {
- FX_WCHAR wch = wsText.GetAt(i);
+ wchar_t wch = wsText.GetAt(i);
if (wch == 0xA0)
wch = 0x20;
dwStatus = m_pBreak->AppendChar(wch);
- if (dwStatus != CFX_RTFBreakType::None &&
- dwStatus != CFX_RTFBreakType::Piece) {
+ if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece) {
AppendTextLine(dwStatus, fLinePos, bSavePieces);
if (IsEnd(bSavePieces)) {
if (m_pLoader)
m_pLoader->m_iChar = i;
return true;
}
- if (dwStatus == CFX_RTFBreakType::Paragraph && m_bRichText)
+ if (dwStatus == CFX_BreakType::Paragraph && m_bRichText)
fLinePos += fSpaceAbove;
}
}
@@ -933,9 +928,9 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
if (iLen == 0)
return;
- FX_WCHAR* psz = wsText.GetBuffer(iLen);
+ wchar_t* psz = wsText.GetBuffer(iLen);
int32_t iTrimLeft = 0;
- FX_WCHAR wch = 0, wPrev = 0;
+ wchar_t wch = 0, wPrev = 0;
for (int32_t i = 0; i < iLen; i++) {
wch = psz[i];
if (wch < 0x20)
@@ -950,21 +945,22 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
wsText = wsText.Left(iTrimLeft);
}
-void CXFA_TextLayout::EndBreak(CFX_RTFBreakType dwStatus,
- FX_FLOAT& fLinePos,
+void CXFA_TextLayout::EndBreak(CFX_BreakType dwStatus,
+ float& fLinePos,
bool bSavePieces) {
dwStatus = m_pBreak->EndBreak(dwStatus);
- if (dwStatus != CFX_RTFBreakType::None && dwStatus != CFX_RTFBreakType::Piece)
+ if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece)
AppendTextLine(dwStatus, fLinePos, bSavePieces, true);
}
void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
CXFA_PieceLine* pPieceLine) {
- if (!m_pTabstopContext || m_pTabstopContext->m_iTabCount == 0)
- return;
if (!pStyle || !pPieceLine)
return;
+ if (!m_pTabstopContext || m_pTabstopContext->m_tabstops.empty())
+ return;
+
int32_t iPieces = pdfium::CollectionSize<int32_t>(pPieceLine->m_textPieces);
if (iPieces == 0)
return;
@@ -972,13 +968,13 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
XFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPieces - 1].get();
int32_t& iTabstopsIndex = m_pTabstopContext->m_iTabIndex;
int32_t iCount = m_textParser.CountTabs(pStyle);
- if (iTabstopsIndex > m_pTabstopContext->m_iTabCount - 1)
+ if (!pdfium::IndexInBounds(m_pTabstopContext->m_tabstops, iTabstopsIndex))
return;
if (iCount > 0) {
iTabstopsIndex++;
m_pTabstopContext->m_bTabstops = true;
- FX_FLOAT fRight = 0;
+ float fRight = 0;
if (iPieces > 1) {
XFA_TextPiece* p = pPieceLine->m_textPieces[iPieces - 2].get();
fRight = p->rtPiece.right();
@@ -986,11 +982,9 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
m_pTabstopContext->m_fTabWidth =
pPiece->rtPiece.width + pPiece->rtPiece.left - fRight;
} else if (iTabstopsIndex > -1) {
- FX_FLOAT fLeft = 0;
+ float fLeft = 0;
if (m_pTabstopContext->m_bTabstops) {
- XFA_TABSTOPS* pTabstops =
- m_pTabstopContext->m_tabstops.GetDataPtr(iTabstopsIndex);
- uint32_t dwAlign = pTabstops->dwAlign;
+ uint32_t dwAlign = m_pTabstopContext->m_tabstops[iTabstopsIndex].dwAlign;
if (dwAlign == FX_HashCode_GetW(L"center", false)) {
fLeft = pPiece->rtPiece.width / 2.0f;
} else if (dwAlign == FX_HashCode_GetW(L"right", false) ||
@@ -1014,8 +1008,8 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
}
}
-void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
- FX_FLOAT& fLinePos,
+void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus,
+ float& fLinePos,
bool bSavePieces,
bool bEndBreak) {
int32_t iPieces = m_pBreak->CountBreakPieces();
@@ -1030,15 +1024,15 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
if (m_pTabstopContext)
m_pTabstopContext->Reset();
- FX_FLOAT fLineStep = 0, fBaseLine = 0;
+ float fLineStep = 0, fBaseLine = 0;
int32_t i = 0;
for (i = 0; i < iPieces; i++) {
- const CFX_RTFPiece* pPiece = m_pBreak->GetBreakPiece(i);
+ const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i);
CXFA_TextUserData* pUserData =
static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get());
if (pUserData)
pStyle = pUserData->m_pStyle;
- FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f;
+ float fVerScale = pPiece->m_iVerticalScale / 100.0f;
auto pTP = pdfium::MakeUnique<XFA_TextPiece>();
pTP->iChars = pPiece->m_iChars;
@@ -1056,15 +1050,15 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
pTP->fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle.Get());
pTP->rtPiece.left = pPiece->m_iStartPos / 20000.0f;
pTP->rtPiece.width = pPiece->m_iWidth / 20000.0f;
- pTP->rtPiece.height = (FX_FLOAT)pPiece->m_iFontSize * fVerScale / 20.0f;
- FX_FLOAT fBaseLineTemp =
+ pTP->rtPiece.height = (float)pPiece->m_iFontSize * fVerScale / 20.0f;
+ float fBaseLineTemp =
m_textParser.GetBaseline(m_pTextProvider, pStyle.Get());
pTP->rtPiece.top = fBaseLineTemp;
- FX_FLOAT fLineHeight = m_textParser.GetLineHeight(
+ float fLineHeight = m_textParser.GetLineHeight(
m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale);
if (fBaseLineTemp > 0) {
- FX_FLOAT fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height;
+ float fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height;
if (fLineHeight < fLineHeightTmp)
fLineHeight = fLineHeightTmp;
else
@@ -1078,29 +1072,28 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
DoTabstops(pStyle.Get(), pPieceLine);
}
for (const auto& pTP : pPieceLine->m_textPieces) {
- FX_FLOAT& fTop = pTP->rtPiece.top;
- FX_FLOAT fBaseLineTemp = fTop;
+ float& fTop = pTP->rtPiece.top;
+ float fBaseLineTemp = fTop;
fTop = fLinePos + fLineStep - pTP->rtPiece.height - fBaseLineTemp;
fTop = std::max(0.0f, fTop);
}
fLinePos += fLineStep + fBaseLine;
} else {
- FX_FLOAT fLineStep = 0;
- FX_FLOAT fLineWidth = 0;
+ float fLineStep = 0;
+ float fLineWidth = 0;
for (int32_t i = 0; i < iPieces; i++) {
- const CFX_RTFPiece* pPiece = m_pBreak->GetBreakPiece(i);
+ const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i);
CXFA_TextUserData* pUserData =
static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get());
if (pUserData)
pStyle = pUserData->m_pStyle;
- FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f;
- FX_FLOAT fBaseLine =
- m_textParser.GetBaseline(m_pTextProvider, pStyle.Get());
- FX_FLOAT fLineHeight = m_textParser.GetLineHeight(
+ float fVerScale = pPiece->m_iVerticalScale / 100.0f;
+ float fBaseLine = m_textParser.GetBaseline(m_pTextProvider, pStyle.Get());
+ float fLineHeight = m_textParser.GetLineHeight(
m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale);
if (fBaseLine > 0) {
- FX_FLOAT fLineHeightTmp =
- fBaseLine + (FX_FLOAT)pPiece->m_iFontSize * fVerScale / 20.0f;
+ float fLineHeightTmp =
+ fBaseLine + (float)pPiece->m_iFontSize * fVerScale / 20.0f;
if (fLineHeight < fLineHeightTmp) {
fLineHeight = fLineHeightTmp;
}
@@ -1111,24 +1104,24 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
fLinePos += fLineStep;
m_fMaxWidth = std::max(m_fMaxWidth, fLineWidth);
if (m_pLoader && m_pLoader->m_bSaveLineHeight) {
- FX_FLOAT fHeight = fLinePos - m_pLoader->m_fLastPos;
+ float fHeight = fLinePos - m_pLoader->m_fLastPos;
m_pLoader->m_fLastPos = fLinePos;
- m_pLoader->m_lineHeights.Add(fHeight);
+ m_pLoader->m_lineHeights.push_back(fHeight);
}
}
m_pBreak->ClearBreakPieces();
- if (dwStatus == CFX_RTFBreakType::Paragraph) {
+ if (dwStatus == CFX_BreakType::Paragraph) {
m_pBreak->Reset();
if (!pStyle && bEndBreak) {
CXFA_Para para = m_pTextProvider->GetParaNode();
if (para) {
- FX_FLOAT fStartPos = para.GetMarginLeft();
- FX_FLOAT fIndent = para.GetTextIndent();
+ float fStartPos = para.GetMarginLeft();
+ float fIndent = para.GetTextIndent();
if (fIndent > 0)
fStartPos += fIndent;
- FX_FLOAT fSpaceBelow = para.GetSpaceBelow();
+ float fSpaceBelow = para.GetSpaceBelow();
if (fSpaceBelow < 0.1f)
fSpaceBelow = 0;
@@ -1139,12 +1132,12 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
}
if (pStyle) {
- FX_FLOAT fStart = 0;
+ float fStart = 0;
const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
if (pRect)
fStart = pRect->left.GetValue();
- FX_FLOAT fTextIndent = pStyle->GetTextIndent().GetValue();
+ float fTextIndent = pStyle->GetTextIndent().GetValue();
if (fTextIndent < 0)
fStart -= fTextIndent;
@@ -1166,7 +1159,7 @@ void CXFA_TextLayout::RenderString(CFDE_RenderDevice* pDevice,
pDevice->DrawString(pBrush, pPiece->pFont, pCharPos, iCount,
pPiece->fFontSize, &tmDoc2Device);
}
- pPieceLine->m_charCounts.Add(iCount);
+ pPieceLine->m_charCounts.push_back(iCount);
}
void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
@@ -1182,11 +1175,11 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
return;
pPen->SetColor(pPiece->dwColor);
- std::unique_ptr<CFDE_Path> pPath(new CFDE_Path);
+ auto pPath = pdfium::MakeUnique<CFDE_Path>();
int32_t iChars = GetDisplayPos(pPiece, pCharPos);
if (iChars > 0) {
CFX_PointF pt1, pt2;
- FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f;
+ float fEndY = pCharPos[0].m_Origin.y + 1.05f;
if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) {
for (int32_t i = 0; i < pPiece->iUnderline; i++) {
for (int32_t j = 0; j < iChars; j++) {
@@ -1224,10 +1217,11 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
return;
}
int32_t iCharsTmp = 0;
- int32_t iPiecePrev = iPiece, iPieceNext = iPiece;
+ int32_t iPiecePrev = iPiece;
+ int32_t iPieceNext = iPiece;
while (iPiecePrev > 0) {
iPiecePrev--;
- iCharsTmp = pPieceLine->m_charCounts.GetAt(iPiecePrev);
+ iCharsTmp = pPieceLine->m_charCounts[iPiecePrev];
if (iCharsTmp > 0)
break;
}
@@ -1238,15 +1232,15 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
int32_t iPieces = pdfium::CollectionSize<int32_t>(pPieceLine->m_textPieces);
while (iPieceNext < iPieces - 1) {
iPieceNext++;
- iCharsTmp = pPieceLine->m_charCounts.GetAt(iPieceNext);
+ iCharsTmp = pPieceLine->m_charCounts[iPieceNext];
if (iCharsTmp > 0)
break;
}
if (iCharsTmp == 0)
return;
- FX_FLOAT fOrgX = 0.0f;
- FX_FLOAT fEndX = 0.0f;
+ float fOrgX = 0.0f;
+ float fEndX = 0.0f;
pPiece = pPieceLine->m_textPieces[iPiecePrev].get();
iChars = GetDisplayPos(pPiece, pCharPos);
if (iChars < 1)
@@ -1264,7 +1258,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
CFX_PointF pt2;
pt1.x = fOrgX;
pt2.x = fEndX;
- FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f;
+ float fEndY = pCharPos[0].m_Origin.y + 1.05f;
for (int32_t i = 0; i < pPiece->iUnderline; i++) {
pt1.y = fEndY;
pt2.y = fEndY;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h
index d4d60cf81e6..9bfc9772474 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h
@@ -37,17 +37,17 @@ class CXFA_TextLayout {
~CXFA_TextLayout();
int32_t GetText(CFX_WideString& wsText);
- FX_FLOAT GetLayoutHeight();
- FX_FLOAT StartLayout(FX_FLOAT fWidth = -1);
+ float GetLayoutHeight();
+ float StartLayout(float fWidth = -1);
bool DoLayout(int32_t iBlockIndex,
- FX_FLOAT& fCalcHeight,
- FX_FLOAT fContentAreaHeight = -1,
- FX_FLOAT fTextHeight = -1);
+ float& fCalcHeight,
+ float fContentAreaHeight = -1,
+ float fTextHeight = -1);
bool CalcSize(const CFX_SizeF& minSize,
const CFX_SizeF& maxSize,
CFX_SizeF& defaultSize);
- bool Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr);
+ bool Layout(const CFX_SizeF& size, float* fHeight = nullptr);
void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex);
bool DrawString(CFX_RenderDevice* pFxDevice,
const CFX_Matrix& tmDoc2Device,
@@ -60,28 +60,28 @@ class CXFA_TextLayout {
}
bool m_bHasBlock;
- CFX_ArrayTemplate<int32_t> m_Blocks;
+ std::vector<int32_t> m_Blocks;
private:
void GetTextDataNode();
CFDE_XMLNode* GetXMLContainerNode();
std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault);
- void InitBreak(FX_FLOAT fLineWidth);
+ void InitBreak(float fLineWidth);
void InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
- FX_FLOAT fLineWidth,
+ float fLineWidth,
CFDE_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle = nullptr);
bool Loader(const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces = true);
void LoadText(CXFA_Node* pNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces);
bool LoadRichText(CFDE_XMLNode* pXMLNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
bool bSavePieces,
CFX_RetainPtr<CXFA_LinkUserData> pLinkData,
@@ -89,17 +89,17 @@ class CXFA_TextLayout {
bool bIsOl = false,
int32_t iLiCount = 0);
bool AppendChar(const CFX_WideString& wsText,
- FX_FLOAT& fLinePos,
- FX_FLOAT fSpaceAbove,
+ float& fLinePos,
+ float fSpaceAbove,
bool bSavePieces);
- void AppendTextLine(CFX_RTFBreakType dwStatus,
- FX_FLOAT& fLinePos,
+ void AppendTextLine(CFX_BreakType dwStatus,
+ float& fLinePos,
bool bSavePieces,
bool bEndBreak = false);
- void EndBreak(CFX_RTFBreakType dwStatus, FX_FLOAT& fLinePos, bool bDefault);
+ void EndBreak(CFX_BreakType dwStatus, float& fLinePos, bool bDefault);
bool IsEnd(bool bSavePieces);
void ProcessText(CFX_WideString& wsText);
- void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom);
+ void UpdateAlign(float fHeight, float fBottom);
void RenderString(CFDE_RenderDevice* pDevice,
CFDE_Brush* pBrush,
CXFA_PieceLine* pPieceLine,
@@ -126,7 +126,7 @@ class CXFA_TextLayout {
std::unique_ptr<CFX_RTFBreak> m_pBreak;
std::unique_ptr<CXFA_LoaderContext> m_pLoader;
int32_t m_iLines;
- FX_FLOAT m_fMaxWidth;
+ float m_fMaxWidth;
CXFA_TextParser m_textParser;
std::vector<std::unique_ptr<CXFA_PieceLine>> m_pieceLines;
std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h
index 5ea68e94739..514d5d74783 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h
@@ -31,7 +31,7 @@ class CXFA_TextParseContext {
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
- protected:
+ private:
std::vector<const CFDE_CSSDeclaration*> decls_;
FDE_CSSDisplay m_eDisplay;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp
index 9759cb219d2..6f394dd5e24 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp
@@ -15,16 +15,18 @@
#include "xfa/fde/css/cfde_cssstyleselector.h"
#include "xfa/fde/css/cfde_cssstylesheet.h"
#include "xfa/fde/css/fde_css.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fxfa/app/cxfa_csstagprovider.h"
#include "xfa/fxfa/app/cxfa_textparsecontext.h"
#include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
namespace {
@@ -43,21 +45,13 @@ enum class TabStopStatus {
CXFA_TextParser::CXFA_TextParser()
: m_bParsed(false), m_cssInitialized(false) {}
-CXFA_TextParser::~CXFA_TextParser() {
- for (auto& pair : m_mapXMLNodeToParseContext) {
- if (pair.second)
- delete pair.second;
- }
-}
+CXFA_TextParser::~CXFA_TextParser() {}
void CXFA_TextParser::Reset() {
- for (auto& pair : m_mapXMLNodeToParseContext) {
- if (pair.second)
- delete pair.second;
- }
m_mapXMLNodeToParseContext.clear();
m_bParsed = false;
}
+
void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
if (!pTextProvider)
return;
@@ -67,12 +61,8 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
CFGAS_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr();
ASSERT(pFontMgr);
m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>(pFontMgr);
- FX_FLOAT fFontSize = 10;
CXFA_Font font = pTextProvider->GetFontNode();
- if (font) {
- fFontSize = font.GetFontSize();
- }
- m_pSelector->SetDefFontSize(fFontSize);
+ m_pSelector->SetDefFontSize(font ? font.GetFontSize() : 10.0f);
}
if (m_cssInitialized)
@@ -85,7 +75,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
}
std::unique_ptr<CFDE_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
- static const FX_WCHAR s_pStyle[] =
+ static const wchar_t s_pStyle[] =
L"html,body,ol,p,ul{display:block}"
L"li{display:list-item}"
L"ol,ul{padding-left:33px;margin:1.12em 0}"
@@ -106,8 +96,8 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
CXFA_Font font = pTextProvider->GetFontNode();
CXFA_Para para = pTextProvider->GetParaNode();
auto pStyle = m_pSelector->CreateComputedStyle(nullptr);
- FX_FLOAT fLineHeight = 0;
- FX_FLOAT fFontSize = 10;
+ float fLineHeight = 0;
+ float fFontSize = 10;
if (para) {
fLineHeight = para.GetLineHeight();
@@ -171,7 +161,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle(
return pNewStyle;
uint32_t dwDecoration = pParentStyle->GetTextDecoration();
- FX_FLOAT fBaseLine = 0;
+ float fBaseLine = 0;
if (pParentStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
fBaseLine = pParentStyle->GetNumberVerticalAlign();
@@ -191,7 +181,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
if (it == m_mapXMLNodeToParseContext.end())
return nullptr;
- CXFA_TextParseContext* pContext = it->second;
+ CXFA_TextParseContext* pContext = it->second.get();
if (!pContext)
return nullptr;
@@ -231,7 +221,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
CFX_RetainPtr<CFDE_CSSComputedStyle> pNewStyle;
if ((tagProvider->GetTagName() != L"body") ||
(tagProvider->GetTagName() != L"html")) {
- CXFA_TextParseContext* pTextContext = new CXFA_TextParseContext;
+ auto pTextContext = pdfium::MakeUnique<CXFA_TextParseContext>();
FDE_CSSDisplay eDisplay = FDE_CSSDisplay::Inline;
if (!tagProvider->m_bContent) {
auto declArray =
@@ -247,7 +237,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
eDisplay = pNewStyle->GetDisplay();
}
pTextContext->SetDisplay(eDisplay);
- m_mapXMLNodeToParseContext[pXMLNode] = pTextContext;
+ m_mapXMLNodeToParseContext[pXMLNode] = std::move(pTextContext);
}
for (CFDE_XMLNode* pXMLChild =
@@ -287,12 +277,11 @@ std::unique_ptr<CXFA_CSSTagProvider> CXFA_TextParser::ParseTagInfo(
CFX_WideString wsName;
if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetLocalTagName(wsName);
+ wsName = pXMLElement->GetLocalTagName();
tagProvider->SetTagName(wsName);
tagProvider->m_bTagAvailable = TagValidate(wsName);
- CFX_WideString wsValue;
- pXMLElement->GetString(L"style", wsValue);
+ CFX_WideString wsValue = pXMLElement->GetString(L"style");
if (!wsValue.IsEmpty())
tagProvider->SetAttribute(L"style", wsValue);
} else if (pXMLNode->GetType() == FDE_XMLNODE_Text) {
@@ -307,7 +296,7 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const {
return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top;
}
-FX_FLOAT CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue))
return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt);
@@ -361,8 +350,8 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
return pFontMgr->GetFont(pDoc, wsFamily, dwStyle);
}
-FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle)
return pStyle->GetFontSize();
@@ -383,7 +372,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
while (pXMLNode) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
if (it != m_mapXMLNodeToParseContext.end()) {
- CXFA_TextParseContext* pContext = it->second;
+ CXFA_TextParseContext* pContext = it->second.get();
if (pContext && pContext->m_pParentStyle &&
pContext->m_pParentStyle->GetCustomStyle(
L"xfa-font-horizontal-scale", wsValue)) {
@@ -466,8 +455,8 @@ FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
return 0xFF000000;
}
-FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle) {
if (pStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
return pStyle->GetNumberVerticalAlign();
@@ -477,18 +466,18 @@ FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
return 0;
}
-FX_FLOAT CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
- bool bFirst,
- FX_FLOAT fVerScale) const {
- FX_FLOAT fLineHeight = 0;
+float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle,
+ bool bFirst,
+ float fVerScale) const {
+ float fLineHeight = 0;
if (pStyle)
fLineHeight = pStyle->GetLineHeight();
else if (CXFA_Para para = pTextProvider->GetParaNode())
fLineHeight = para.GetLineHeight();
if (bFirst) {
- FX_FLOAT fFontSize = GetFontSize(pTextProvider, pStyle);
+ float fFontSize = GetFontSize(pTextProvider, pStyle);
if (fLineHeight < 0.1f)
fLineHeight = fFontSize;
else
@@ -510,15 +499,13 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
bool bRet = false;
if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- CFX_WideString wsAttr;
- pElement->GetString(L"xfa:embed", wsAttr);
+ CFX_WideString wsAttr = pElement->GetString(L"xfa:embed");
if (wsAttr.IsEmpty())
return false;
if (wsAttr.GetAt(0) == L'#')
wsAttr.Delete(0);
- CFX_WideString ws;
- pElement->GetString(L"xfa:embedType", ws);
+ CFX_WideString ws = pElement->GetString(L"xfa:embedType");
if (ws.IsEmpty())
ws = L"som";
else
@@ -528,8 +515,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
if (!bURI && ws != L"som")
return false;
- ws.clear();
- pElement->GetString(L"xfa:embedMode", ws);
+ ws = pElement->GetString(L"xfa:embedMode");
if (ws.IsEmpty())
ws = L"formatted";
else
@@ -547,7 +533,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap(
CFDE_XMLNode* pXMLNode) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
- return it != m_mapXMLNodeToParseContext.end() ? it->second : nullptr;
+ return it != m_mapXMLNodeToParseContext.end() ? it->second.get() : nullptr;
}
bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
@@ -562,12 +548,12 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
}
int32_t iLength = wsValue.GetLength();
- const FX_WCHAR* pTabStops = wsValue.c_str();
+ const wchar_t* pTabStops = wsValue.c_str();
int32_t iCur = 0;
int32_t iLast = 0;
CFX_WideString wsAlign;
TabStopStatus eStatus = TabStopStatus::None;
- FX_WCHAR ch;
+ wchar_t ch;
while (iCur < iLength) {
ch = pTabStops[iCur];
switch (eStatus) {
@@ -618,7 +604,7 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
if (ch == ' ') {
uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true);
CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
- FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt);
+ float fPos = ms.ToUnit(XFA_UNIT_Pt);
pTabstopContext->Append(dwHashCode, fPos);
wsAlign.clear();
eStatus = TabStopStatus::None;
@@ -633,7 +619,7 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
if (!wsAlign.IsEmpty()) {
uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true);
CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
- FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt);
+ float fPos = ms.ToUnit(XFA_UNIT_Pt);
pTabstopContext->Append(dwHashCode, fPos);
}
return true;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h
index 86da502dbf0..29f03a8dea7 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h
@@ -43,7 +43,7 @@ class CXFA_TextParser {
int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const;
- FX_FLOAT GetTabInterval(CFDE_CSSComputedStyle* pStyle) const;
+ float GetTabInterval(CFDE_CSSComputedStyle* pStyle) const;
int32_t CountTabs(CFDE_CSSComputedStyle* pStyle) const;
bool IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const;
@@ -52,8 +52,8 @@ class CXFA_TextParser {
CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle) const;
- FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ float GetFontSize(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const;
int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle,
@@ -70,12 +70,12 @@ class CXFA_TextParser {
int32_t& iLinethrough) const;
FX_ARGB GetColor(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle) const;
- FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
- FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
- bool bFirst,
- FX_FLOAT fVerScale) const;
+ float GetBaseline(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const;
+ float GetLineHeight(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle,
+ bool bFirst,
+ float fVerScale) const;
bool GetEmbbedObj(CXFA_TextProvider* pTextProvider,
CFDE_XMLNode* pXMLNode,
@@ -94,10 +94,11 @@ class CXFA_TextParser {
CFX_RetainPtr<CFDE_CSSComputedStyle> CreateStyle(
CFDE_CSSComputedStyle* pParentStyle);
- std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
- std::map<CFDE_XMLNode*, CXFA_TextParseContext*> m_mapXMLNodeToParseContext;
bool m_bParsed;
bool m_cssInitialized;
+ std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
+ std::map<CFDE_XMLNode*, std::unique_ptr<CXFA_TextParseContext>>
+ m_mapXMLNodeToParseContext;
};
#endif // XFA_FXFA_APP_CXFA_TEXTPARSER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp
index 3209603af3b..58ceb21a4b1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp
@@ -7,33 +7,21 @@
#include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
CXFA_TextTabstopsContext::CXFA_TextTabstopsContext()
- : m_iTabCount(0),
- m_iTabIndex(-1),
- m_bTabstops(false),
- m_fTabWidth(0),
- m_fLeft(0) {}
+ : m_iTabIndex(-1), m_bTabstops(false), m_fTabWidth(0), m_fLeft(0) {}
CXFA_TextTabstopsContext::~CXFA_TextTabstopsContext() {}
-void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, FX_FLOAT fTabstops) {
- int32_t i = 0;
- for (i = 0; i < m_iTabCount; i++) {
- XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i);
- if (fTabstops < pTabstop->fTabstops) {
- break;
- }
- }
- m_tabstops.InsertSpaceAt(i, 1);
+void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, float fTabstops) {
XFA_TABSTOPS tabstop;
tabstop.dwAlign = dwAlign;
tabstop.fTabstops = fTabstops;
- m_tabstops.SetAt(i, tabstop);
- m_iTabCount++;
+
+ auto it = std::lower_bound(m_tabstops.begin(), m_tabstops.end(), tabstop);
+ m_tabstops.insert(it, tabstop);
}
void CXFA_TextTabstopsContext::RemoveAll() {
- m_tabstops.RemoveAll();
- m_iTabCount = 0;
+ m_tabstops.clear();
}
void CXFA_TextTabstopsContext::Reset() {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h
index 8fe0e6273f3..9be10dd61d0 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h
@@ -7,11 +7,17 @@
#ifndef XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_
#define XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
struct XFA_TABSTOPS {
uint32_t dwAlign;
- FX_FLOAT fTabstops;
+ float fTabstops;
+
+ bool operator<(const XFA_TABSTOPS& that) const {
+ return fTabstops < that.fTabstops;
+ }
};
class CXFA_TextTabstopsContext {
@@ -19,16 +25,15 @@ class CXFA_TextTabstopsContext {
CXFA_TextTabstopsContext();
~CXFA_TextTabstopsContext();
- void Append(uint32_t dwAlign, FX_FLOAT fTabstops);
+ void Append(uint32_t dwAlign, float fTabstops);
void RemoveAll();
void Reset();
- CFX_ArrayTemplate<XFA_TABSTOPS> m_tabstops;
- int32_t m_iTabCount;
int32_t m_iTabIndex;
bool m_bTabstops;
- FX_FLOAT m_fTabWidth;
- FX_FLOAT m_fLeft;
+ float m_fTabWidth;
+ float m_fLeft;
+ std::vector<XFA_TABSTOPS> m_tabstops;
};
#endif // XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h
index b0eff73f2e9..18a20cdc2ad 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h
@@ -21,7 +21,7 @@ class CXFA_TextUserData : public CFX_Retainable {
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pStyle;
CFX_RetainPtr<CXFA_LinkUserData> m_pLinkData;
- protected:
+ private:
explicit CXFA_TextUserData(
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle);
CXFA_TextUserData(const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp
deleted file mode 100644
index 09c42719c11..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-// 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/fxfa/xfa_checksum.h"
-
-#include "core/fdrm/crypto/fx_crypt.h"
-#include "third_party/base/ptr_util.h"
-
-namespace {
-
-struct FX_BASE64DATA {
- uint32_t data1 : 2;
- uint32_t data2 : 6;
- uint32_t data3 : 4;
- uint32_t data4 : 4;
- uint32_t data5 : 6;
- uint32_t data6 : 2;
- uint32_t data7 : 8;
-};
-
-const FX_CHAR g_FXBase64EncoderMap[64] = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
-};
-
-void Base64EncodePiece(const FX_BASE64DATA& src,
- int32_t iBytes,
- FX_CHAR dst[4]) {
- dst[0] = g_FXBase64EncoderMap[src.data2];
- uint32_t b = src.data1 << 4;
- if (iBytes > 1) {
- b |= src.data4;
- }
- dst[1] = g_FXBase64EncoderMap[b];
- if (iBytes > 1) {
- b = src.data3 << 2;
- if (iBytes > 2) {
- b |= src.data6;
- }
- dst[2] = g_FXBase64EncoderMap[b];
- if (iBytes > 2) {
- dst[3] = g_FXBase64EncoderMap[src.data5];
- } else {
- dst[3] = '=';
- }
- } else {
- dst[2] = dst[3] = '=';
- }
-}
-
-int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) {
- ASSERT(pSrc);
- if (iSrcLen < 1) {
- return 0;
- }
- if (!pDst) {
- int32_t iDstLen = iSrcLen / 3 * 4;
- if ((iSrcLen % 3) != 0) {
- iDstLen += 4;
- }
- return iDstLen;
- }
- FX_BASE64DATA srcData;
- int32_t iBytes = 3;
- FX_CHAR* pDstEnd = pDst;
- while (iSrcLen > 0) {
- if (iSrcLen > 2) {
- ((uint8_t*)&srcData)[0] = *pSrc++;
- ((uint8_t*)&srcData)[1] = *pSrc++;
- ((uint8_t*)&srcData)[2] = *pSrc++;
- iSrcLen -= 3;
- } else {
- *((uint32_t*)&srcData) = 0;
- ((uint8_t*)&srcData)[0] = *pSrc++;
- if (iSrcLen > 1) {
- ((uint8_t*)&srcData)[1] = *pSrc++;
- }
- iBytes = iSrcLen;
- iSrcLen = 0;
- }
- Base64EncodePiece(srcData, iBytes, pDstEnd);
- pDstEnd += 4;
- }
- return pDstEnd - pDst;
-}
-
-} // namespace
-
-CXFA_SAXReaderHandler::CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext)
- : m_pContext(pContext) {
- ASSERT(m_pContext);
-}
-CXFA_SAXReaderHandler::~CXFA_SAXReaderHandler() {}
-CXFA_SAXContext* CXFA_SAXReaderHandler::OnTagEnter(
- const CFX_ByteStringC& bsTagName,
- CFX_SAXItem::Type eType,
- uint32_t dwStartPos) {
- UpdateChecksum(true);
- if (eType != CFX_SAXItem::Type::Tag &&
- eType != CFX_SAXItem::Type::Instruction) {
- return nullptr;
- }
- m_SAXContext.m_eNode = eType;
- CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf;
- textBuf << "<";
- if (eType == CFX_SAXItem::Type::Instruction) {
- textBuf << "?";
- }
- textBuf << bsTagName;
- m_SAXContext.m_bsTagName = bsTagName;
- return &m_SAXContext;
-}
-
-void CXFA_SAXReaderHandler::OnTagAttribute(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) {
- if (!pTag)
- return;
-
- pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\"";
-}
-
-void CXFA_SAXReaderHandler::OnTagBreak(CXFA_SAXContext* pTag) {
- if (!pTag)
- return;
-
- pTag->m_TextBuf << ">";
- UpdateChecksum(false);
-}
-
-void CXFA_SAXReaderHandler::OnTagData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos) {
- if (!pTag)
- return;
-
- CFX_ByteTextBuf& textBuf = pTag->m_TextBuf;
- if (eType == CFX_SAXItem::Type::CharData)
- textBuf << "<![CDATA[";
-
- textBuf << bsData;
- if (eType == CFX_SAXItem::Type::CharData)
- textBuf << "]]>";
-}
-
-void CXFA_SAXReaderHandler::OnTagClose(CXFA_SAXContext* pTag,
- uint32_t dwEndPos) {
- if (!pTag)
- return;
-
- CFX_ByteTextBuf& textBuf = pTag->m_TextBuf;
- if (pTag->m_eNode == CFX_SAXItem::Type::Instruction)
- textBuf << "?>";
- else if (pTag->m_eNode == CFX_SAXItem::Type::Tag)
- textBuf << "></" << pTag->m_bsTagName.AsStringC() << ">";
-
- UpdateChecksum(false);
-}
-
-void CXFA_SAXReaderHandler::OnTagEnd(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
- uint32_t dwEndPos) {
- if (!pTag)
- return;
-
- pTag->m_TextBuf << "</" << bsTagName << ">";
- UpdateChecksum(false);
-}
-
-void CXFA_SAXReaderHandler::OnTargetData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos) {
- if (!pTag && eType != CFX_SAXItem::Type::Comment)
- return;
-
- if (eType == CFX_SAXItem::Type::Comment) {
- m_SAXContext.m_TextBuf << "<!--" << bsData << "-->";
- UpdateChecksum(false);
- } else {
- pTag->m_TextBuf << " " << bsData;
- }
-}
-
-void CXFA_SAXReaderHandler::UpdateChecksum(bool bCheckSpace) {
- int32_t iLength = m_SAXContext.m_TextBuf.GetLength();
- if (iLength < 1) {
- return;
- }
- uint8_t* pBuffer = m_SAXContext.m_TextBuf.GetBuffer();
- bool bUpdata = true;
- if (bCheckSpace) {
- bUpdata = false;
- for (int32_t i = 0; i < iLength; i++) {
- bUpdata = (pBuffer[i] > 0x20);
- if (bUpdata) {
- break;
- }
- }
- }
- if (bUpdata) {
- m_pContext->Update(CFX_ByteStringC(pBuffer, iLength));
- }
- m_SAXContext.m_TextBuf.Clear();
-}
-
-CXFA_ChecksumContext::CXFA_ChecksumContext() {}
-
-CXFA_ChecksumContext::~CXFA_ChecksumContext() {}
-
-void CXFA_ChecksumContext::StartChecksum() {
- FinishChecksum();
- m_pByteContext = pdfium::MakeUnique<CRYPT_sha1_context>();
- CRYPT_SHA1Start(m_pByteContext.get());
- m_bsChecksum.clear();
- m_pSAXReader = pdfium::MakeUnique<CFX_SAXReader>();
-}
-
-bool CXFA_ChecksumContext::UpdateChecksum(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
- FX_FILESIZE offset,
- size_t size) {
- if (!m_pSAXReader || !pSrcFile)
- return false;
-
- if (size < 1)
- size = pSrcFile->GetSize();
-
- CXFA_SAXReaderHandler handler(this);
- m_pSAXReader->SetHandler(&handler);
- if (m_pSAXReader->StartParse(
- pSrcFile, (uint32_t)offset, (uint32_t)size,
- CFX_SaxParseMode_NotSkipSpace | CFX_SaxParseMode_NotConvert_amp |
- CFX_SaxParseMode_NotConvert_lt | CFX_SaxParseMode_NotConvert_gt |
- CFX_SaxParseMode_NotConvert_sharp) < 0) {
- return false;
- }
- return m_pSAXReader->ContinueParse(nullptr) > 99;
-}
-
-void CXFA_ChecksumContext::FinishChecksum() {
- m_pSAXReader.reset();
- if (m_pByteContext) {
- uint8_t digest[20];
- FXSYS_memset(digest, 0, 20);
- CRYPT_SHA1Finish(m_pByteContext.get(), digest);
- int32_t nLen = Base64EncodeA(digest, 20, nullptr);
- FX_CHAR* pBuffer = m_bsChecksum.GetBuffer(nLen);
- Base64EncodeA(digest, 20, pBuffer);
- m_bsChecksum.ReleaseBuffer(nLen);
- m_pByteContext.reset();
- }
-}
-
-CFX_ByteString CXFA_ChecksumContext::GetChecksum() const {
- return m_bsChecksum;
-}
-
-void CXFA_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
- if (!m_pByteContext)
- return;
-
- CRYPT_SHA1Update(m_pByteContext.get(), bsText.raw_str(), bsText.GetLength());
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp
deleted file mode 100644
index 219f06e4ff7..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// 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/fxfa/xfa_ffapp.h"
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fwl/cfwl_widgetmgr.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdochandler.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
-
-namespace {
-
-class CXFA_FileRead : public IFX_SeekableReadStream {
- public:
- explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams);
- ~CXFA_FileRead() override;
-
- // IFX_SeekableReadStream
- FX_FILESIZE GetSize() override;
- bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
-
- private:
- std::vector<std::unique_ptr<CPDF_StreamAcc>> m_Data;
-};
-
-CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) {
- for (CPDF_Stream* pStream : streams) {
- m_Data.push_back(pdfium::MakeUnique<CPDF_StreamAcc>());
- m_Data.back()->LoadAllData(pStream);
- }
-}
-
-CXFA_FileRead::~CXFA_FileRead() {}
-
-FX_FILESIZE CXFA_FileRead::GetSize() {
- uint32_t dwSize = 0;
- for (const auto& acc : m_Data)
- dwSize += acc->GetSize();
- return dwSize;
-}
-
-bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Data);
- int32_t index = 0;
- while (index < iCount) {
- const auto& acc = m_Data[index];
- FX_FILESIZE dwSize = acc->GetSize();
- if (offset < dwSize)
- break;
-
- offset -= dwSize;
- index++;
- }
- while (index < iCount) {
- const auto& acc = m_Data[index];
- uint32_t dwSize = acc->GetSize();
- size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset));
- FXSYS_memcpy(buffer, acc->GetData() + offset, dwRead);
- size -= dwRead;
- if (size == 0)
- return true;
-
- buffer = (uint8_t*)buffer + dwRead;
- offset = 0;
- index++;
- }
- return false;
-}
-
-} // namespace
-
-CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(
- const std::vector<CPDF_Stream*>& streams) {
- return CFX_RetainPtr<IFX_SeekableReadStream>(new CXFA_FileRead(streams));
-}
-
-CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
- : m_pProvider(pProvider),
- m_pWidgetMgrDelegate(nullptr),
- m_pFWLApp(new CFWL_App(this)) {}
-
-CXFA_FFApp::~CXFA_FFApp() {}
-
-CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
- if (!m_pDocHandler)
- m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>();
- return m_pDocHandler.get();
-}
-
-std::unique_ptr<CXFA_FFDoc> CXFA_FFApp::CreateDoc(
- IXFA_DocEnvironment* pDocEnvironment,
- CPDF_Document* pPDFDoc) {
- if (!pPDFDoc)
- return nullptr;
-
- auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment);
- if (!pDoc->OpenDoc(pPDFDoc))
- return nullptr;
-
- return pDoc;
-}
-
-void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
- if (!m_pFontMgr)
- m_pFontMgr = pdfium::MakeUnique<CXFA_FontMgr>();
- m_pFontMgr->SetDefFontMgr(std::move(pFontMgr));
-}
-
-CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() const {
- return m_pFontMgr.get();
-}
-
-CFGAS_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
- if (!m_pFDEFontMgr) {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- m_pFDEFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
-#else
- m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
- m_pFDEFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
-#endif
- }
- return m_pFDEFontMgr.get();
-}
-
-CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() {
- if (!m_pFWLTheme)
- m_pFWLTheme = pdfium::MakeUnique<CXFA_FWLTheme>(this);
- return m_pFWLTheme.get();
-}
-
-CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr(
- CFWL_WidgetMgrDelegate* pDelegate) {
- if (!m_pAdapterWidgetMgr) {
- m_pAdapterWidgetMgr = pdfium::MakeUnique<CXFA_FWLAdapterWidgetMgr>();
- pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm);
- m_pWidgetMgrDelegate = pDelegate;
- }
- return m_pAdapterWidgetMgr.get();
-}
-
-IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
- return m_pProvider->GetTimerMgr();
-}
-
-void CXFA_FFApp::ClearEventTargets() {
- m_pFWLApp->GetNoteDriver()->ClearEventTargets(false);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp
deleted file mode 100644
index b0879012b42..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2016 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.
-
-#include "xfa/fxfa/xfa_ffapp.h"
-
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fxcrt/fx_memory.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
-
-TEST(CXFAFileRead, NoStreams) {
- std::vector<CPDF_Stream*> streams;
- CFX_RetainPtr<IFX_SeekableReadStream> fileread =
- MakeSeekableReadStream(streams);
-
- uint8_t output_buffer[16];
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_FALSE(fileread->ReadBlock(output_buffer, 0, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-}
-
-TEST(CXFAFileRead, EmptyStreams) {
- std::vector<CPDF_Stream*> streams;
- auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
- streams.push_back(stream1.get());
- CFX_RetainPtr<IFX_SeekableReadStream> fileread =
- MakeSeekableReadStream(streams);
-
- uint8_t output_buffer[16];
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_FALSE(fileread->ReadBlock(output_buffer, 0, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-}
-
-TEST(CXFAFileRead, NormalStreams) {
- std::vector<CPDF_Stream*> streams;
- auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
- auto stream2 = pdfium::MakeUnique<CPDF_Stream>();
- auto stream3 = pdfium::MakeUnique<CPDF_Stream>();
-
- // 16 chars total.
- stream1->InitStream(reinterpret_cast<const uint8_t*>("one t"), 5,
- pdfium::MakeUnique<CPDF_Dictionary>());
- stream2->InitStream(reinterpret_cast<const uint8_t*>("wo "), 3,
- pdfium::MakeUnique<CPDF_Dictionary>());
- stream3->InitStream(reinterpret_cast<const uint8_t*>("three!!!"), 8,
- pdfium::MakeUnique<CPDF_Dictionary>());
-
- streams.push_back(stream1.get());
- streams.push_back(stream2.get());
- streams.push_back(stream3.get());
- CFX_RetainPtr<IFX_SeekableReadStream> fileread =
- MakeSeekableReadStream(streams);
-
- uint8_t output_buffer[16];
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 1, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, 1));
- EXPECT_EQ(0, memcmp(output_buffer, "o", 1));
- EXPECT_EQ(0xbd, output_buffer[1]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, sizeof(output_buffer)));
- EXPECT_EQ(0, memcmp(output_buffer, "one two three!!!", 16));
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 2, 10));
- EXPECT_EQ(0, memcmp(output_buffer, "e two thre", 10));
- EXPECT_EQ(0xbd, output_buffer[11]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_FALSE(fileread->ReadBlock(output_buffer, 1, sizeof(output_buffer)));
- EXPECT_EQ(0, memcmp(output_buffer, "ne two three!!!", 15));
- EXPECT_EQ(0xbd, output_buffer[15]);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp
index b136b8da5a5..72adb3c96b1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -13,8 +13,8 @@
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fftextedit.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
namespace {
@@ -174,9 +174,9 @@ void CXFA_FFBarcode::UpdateWidgetProperty() {
pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType);
CXFA_WidgetAcc* pAcc = GetDataAcc();
int32_t intVal;
- FX_CHAR charVal;
+ char charVal;
bool boolVal;
- FX_FLOAT floatVal;
+ float floatVal;
if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) {
pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal);
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h
index c20feb5167b..ad12218f3d5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h
@@ -7,9 +7,9 @@
#ifndef XFA_FXFA_APP_XFA_FFBARCODE_H_
#define XFA_FXFA_APP_XFA_FFBARCODE_H_
-#include "xfa/fxbarcode/BC_Library.h"
+#include "fxbarcode/BC_Library.h"
#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFBarcode : public CXFA_FFTextEdit {
public:
@@ -93,7 +93,7 @@ enum XFA_BARCODETYPEENUM {
struct XFA_BARCODETYPEENUMINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_BARCODETYPEENUM eName;
BC_TYPE eBCType;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index f088b5d4dda..9f003ad3a10 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -12,11 +12,11 @@
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fxfa/app/xfa_ffexclgroup.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -49,7 +49,7 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() {
if (!m_pNormalWidget) {
return;
}
- FX_FLOAT fSize = m_pDataAcc->GetCheckButtonSize();
+ float fSize = m_pDataAcc->GetCheckButtonSize();
pCheckBox->SetBoxSize(fSize);
uint32_t dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCross;
int32_t iCheckMark = m_pDataAcc->GetCheckButtonMark();
@@ -86,14 +86,14 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() {
}
bool CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
- FX_FLOAT fCheckSize = m_pDataAcc->GetCheckButtonSize();
+ float fCheckSize = m_pDataAcc->GetCheckButtonSize();
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
CFX_RectF rtWidget = GetRectWithoutRotate();
if (mgWidget) {
XFA_RectWidthoutMargin(rtWidget, mgWidget);
}
int32_t iCapPlacement = -1;
- FX_FLOAT fCapReserve = 0;
+ float fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence()) {
m_rtCaption = rtWidget;
@@ -189,8 +189,8 @@ void CXFA_FFCheckButton::CapLeftRightPlacement(CXFA_Margin mgCap) {
void CXFA_FFCheckButton::AddUIMargin(int32_t iCapPlacement) {
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtUI.top -= rtUIMargin.top / 2 - rtUIMargin.height / 2;
- FX_FLOAT fLeftAddRight = rtUIMargin.left + rtUIMargin.width;
- FX_FLOAT fTopAddBottom = rtUIMargin.top + rtUIMargin.height;
+ float fLeftAddRight = rtUIMargin.left + rtUIMargin.width;
+ float fTopAddBottom = rtUIMargin.top + rtUIMargin.height;
if (m_rtUI.width < fLeftAddRight) {
if (iCapPlacement == XFA_ATTRIBUTEENUM_Right ||
iCapPlacement == XFA_ATTRIBUTEENUM_Left) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h
index 2c0acd6e3ec..75f884144d6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h
@@ -8,7 +8,7 @@
#define XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFCheckButton : public CXFA_FFField {
public:
@@ -32,7 +32,7 @@ class CXFA_FFCheckButton : public CXFA_FFField {
void SetFWLCheckState(XFA_CHECKSTATE eCheckState);
- protected:
+ private:
bool CommitData() override;
bool IsDataChanged() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 3aabde870af..c628d2e47f6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -6,6 +6,7 @@
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include <algorithm>
#include <vector>
#include "third_party/base/ptr_util.h"
@@ -20,10 +21,10 @@
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFListBox::CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -52,25 +53,18 @@ bool CXFA_FFListBox::LoadWidget() {
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- std::vector<CFX_WideString> wsLabelArray;
- m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
- int32_t iItems = pdfium::CollectionSize<int32_t>(wsLabelArray);
- for (int32_t i = 0; i < iItems; i++) {
- pListBox->AddString(wsLabelArray[i].AsStringC());
- }
+ for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
+ pListBox->AddString(label.AsStringC());
+
uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
- if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
+ if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect)
dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
- }
+
dwExtendedStyle |= GetAlignment();
m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- for (int32_t j = 0; j < iSelCount; j++) {
- CFWL_ListItem* item = pListBox->GetItem(nullptr, iSelArray[j]);
- pListBox->SetSelItem(item, true);
- }
+ for (int32_t selected : m_pDataAcc->GetSelectedItems())
+ pListBox->SetSelItem(pListBox->GetItem(nullptr, selected), true);
+
m_pNormalWidget->UnlockUpdate();
return CXFA_FFField::LoadWidget();
}
@@ -84,19 +78,18 @@ bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
bool CXFA_FFListBox::CommitData() {
CFWL_ListBox* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
+ std::vector<int32_t> iSelArray;
int32_t iSels = pListBox->CountSelItems();
- CFX_ArrayTemplate<int32_t> iSelArray;
for (int32_t i = 0; i < iSels; ++i)
- iSelArray.Add(pListBox->GetSelIndex(i));
+ iSelArray.push_back(pListBox->GetSelIndex(i));
m_pDataAcc->SetSelectedItems(iSelArray, true, false, true);
return true;
}
bool CXFA_FFListBox::IsDataChanged() {
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iOldSels = iSelArray.GetSize();
- CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ int32_t iOldSels = pdfium::CollectionSize<int32_t>(iSelArray);
+ auto* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
int32_t iSels = pListBox->CountSelItems();
if (iOldSels != iSels)
return true;
@@ -134,28 +127,24 @@ uint32_t CXFA_FFListBox::GetAlignment() {
return dwExtendedStyle;
}
bool CXFA_FFListBox::UpdateFWLData() {
- if (!m_pNormalWidget) {
+ if (!m_pNormalWidget)
return false;
- }
- CFWL_ListBox* pListBox = ((CFWL_ListBox*)m_pNormalWidget);
- CFX_ArrayTemplate<CFWL_ListItem*> selItemArray;
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- for (int32_t j = 0; j < iSelCount; j++) {
- CFWL_ListItem* lpItemSel = pListBox->GetSelItem(iSelArray[j]);
- selItemArray.Add(lpItemSel);
- }
+
+ auto* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ std::vector<CFWL_ListItem*> selItemArray(iSelArray.size());
+ std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(),
+ [pListBox](int32_t val) { return pListBox->GetSelItem(val); });
+
pListBox->SetSelItem(pListBox->GetSelItem(-1), false);
- for (int32_t i = 0; i < iSelCount; i++) {
- ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(selItemArray[i], true);
- }
+ for (CFWL_ListItem* pItem : selItemArray)
+ pListBox->SetSelItem(pItem, true);
+
m_pNormalWidget->Update();
return true;
}
-void CXFA_FFListBox::OnSelectChanged(
- CFWL_Widget* pWidget,
- const CFX_ArrayTemplate<int32_t>& arrSels) {
+void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget,
+ const std::vector<int32_t>& arrSels) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
eParam.m_pTarget = m_pDataAcc;
@@ -201,7 +190,7 @@ void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
switch (pEvent->GetType()) {
case CFWL_Event::Type::SelectChanged: {
- CFX_ArrayTemplate<int32_t> arrSels;
+ std::vector<int32_t> arrSels;
OnSelectChanged(m_pNormalWidget, arrSels);
break;
}
@@ -227,7 +216,7 @@ CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
}
bool CXFA_FFComboBox::PtInActiveRect(const CFX_PointF& point) {
- auto pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
+ auto* pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
return pComboBox && pComboBox->GetBBox().Contains(point);
}
@@ -244,17 +233,12 @@ bool CXFA_FFComboBox::LoadWidget() {
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- std::vector<CFX_WideString> wsLabelArray;
- m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
- int32_t iItems = pdfium::CollectionSize<int32_t>(wsLabelArray);
- for (int32_t i = 0; i < iItems; i++) {
- pComboBox->AddString(wsLabelArray[i].AsStringC());
- }
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- if (iSelCount > 0) {
- pComboBox->SetCurSel(iSelArray[0]);
+ for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
+ pComboBox->AddString(label.AsStringC());
+
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ if (!iSelArray.empty()) {
+ pComboBox->SetCurSel(iSelArray.front());
} else {
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
@@ -375,24 +359,25 @@ uint32_t CXFA_FFComboBox::GetAlignment() {
}
return dwExtendedStyle;
}
+
bool CXFA_FFComboBox::UpdateFWLData() {
- if (!m_pNormalWidget) {
+ auto* pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
+ if (!pComboBox)
return false;
- }
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- if (iSelCount > 0) {
- ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(iSelArray[0]);
+
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ if (!iSelArray.empty()) {
+ pComboBox->SetCurSel(iSelArray.front());
} else {
CFX_WideString wsText;
- ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1);
+ pComboBox->SetCurSel(-1);
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
- ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText);
+ pComboBox->SetEditText(wsText);
}
- m_pNormalWidget->Update();
+ pComboBox->Update();
return true;
}
+
bool CXFA_FFComboBox::CanUndo() {
return m_pDataAcc->IsChoiceListAllowTextEntry() &&
((CFWL_ComboBox*)m_pNormalWidget)->EditCanUndo();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h
index e89366ad13d..8875655901c 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h
@@ -7,8 +7,10 @@
#ifndef XFA_FXFA_APP_XFA_FFCHOICELIST_H_
#define XFA_FXFA_APP_XFA_FFCHOICELIST_H_
+#include <vector>
+
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFListBox : public CXFA_FFField {
public:
@@ -24,12 +26,12 @@ class CXFA_FFListBox : public CXFA_FFField {
const CFX_Matrix* pMatrix = nullptr) override;
void OnSelectChanged(CFWL_Widget* pWidget,
- const CFX_ArrayTemplate<int32_t>& arrSels);
+ const std::vector<int32_t>& arrSels);
void SetItemState(int32_t nIndex, bool bSelected);
void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1);
void DeleteItem(int32_t nIndex);
- protected:
+ private:
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
@@ -82,7 +84,7 @@ class CXFA_FFComboBox : public CXFA_FFField {
void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1);
void DeleteItem(int32_t nIndex);
- protected:
+ private:
// CXFA_FFField
bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp
deleted file mode 100644
index 911bdf84006..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-// 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/fxfa/xfa_ffdoc.h"
-
-#include <algorithm>
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/parser/cpdf_array.h"
-#include "core/fpdfapi/parser/cpdf_document.h"
-#include "core/fpdfapi/parser/fpdf_parser_decode.h"
-#include "core/fpdfdoc/cpdf_nametree.h"
-#include "core/fxcrt/fx_ext.h"
-#include "core/fxcrt/fx_memory.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
-#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/parser/cxfa_dataexporter.h"
-#include "xfa/fxfa/parser/cxfa_dataimporter.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/xfa_checksum.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
-
-namespace {
-
-struct FX_BASE64DATA {
- uint32_t data1 : 2;
- uint32_t data2 : 6;
- uint32_t data3 : 4;
- uint32_t data4 : 4;
- uint32_t data5 : 6;
- uint32_t data6 : 2;
- uint32_t data7 : 8;
-};
-
-const uint8_t kStartValuesRemoved = 43;
-const uint8_t kDecoderMapSize = 80;
-const uint8_t g_FXBase64DecoderMap[kDecoderMapSize] = {
- 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
- 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,
- 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
- 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
-};
-
-uint8_t base64DecoderValue(uint8_t val) {
- if (val < kStartValuesRemoved || val >= kStartValuesRemoved + kDecoderMapSize)
- return 0xFF;
- return g_FXBase64DecoderMap[val - kStartValuesRemoved];
-}
-
-void Base64DecodePiece(const FX_CHAR src[4],
- int32_t iChars,
- FX_BASE64DATA& dst,
- int32_t& iBytes) {
- ASSERT(iChars > 0 && iChars < 5);
- iBytes = 1;
- dst.data2 = base64DecoderValue(static_cast<uint8_t>(src[0]));
- if (iChars > 1) {
- uint8_t b = base64DecoderValue(static_cast<uint8_t>(src[1]));
- dst.data1 = b >> 4;
- dst.data4 = b;
- if (iChars > 2) {
- iBytes = 2;
- b = base64DecoderValue(static_cast<uint8_t>(src[2]));
- dst.data3 = b >> 2;
- dst.data6 = b;
- if (iChars > 3) {
- iBytes = 3;
- dst.data5 = base64DecoderValue(static_cast<uint8_t>(src[3]));
- } else {
- dst.data5 = 0;
- }
- } else {
- dst.data3 = 0;
- }
- } else {
- dst.data1 = 0;
- }
-}
-
-int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) {
- ASSERT(pSrc);
- if (iSrcLen < 1) {
- return 0;
- }
- while (iSrcLen > 0 && pSrc[iSrcLen - 1] == '=') {
- iSrcLen--;
- }
- if (iSrcLen < 1) {
- return 0;
- }
- if (!pDst) {
- int32_t iDstLen = iSrcLen / 4 * 3;
- iSrcLen %= 4;
- if (iSrcLen == 1) {
- iDstLen += 1;
- } else if (iSrcLen == 2) {
- iDstLen += 1;
- } else if (iSrcLen == 3) {
- iDstLen += 2;
- }
- return iDstLen;
- }
- FX_CHAR srcData[4];
- FX_BASE64DATA dstData;
- int32_t iChars = 4, iBytes;
- uint8_t* pDstEnd = pDst;
- while (iSrcLen > 0) {
- if (iSrcLen > 3) {
- srcData[0] = (FX_CHAR)*pSrc++;
- srcData[1] = (FX_CHAR)*pSrc++;
- srcData[2] = (FX_CHAR)*pSrc++;
- srcData[3] = (FX_CHAR)*pSrc++;
- iSrcLen -= 4;
- } else {
- *((uint32_t*)&dstData) = 0;
- *((uint32_t*)srcData) = 0;
- srcData[0] = (FX_CHAR)*pSrc++;
- if (iSrcLen > 1) {
- srcData[1] = (FX_CHAR)*pSrc++;
- }
- if (iSrcLen > 2) {
- srcData[2] = (FX_CHAR)*pSrc++;
- }
- iChars = iSrcLen;
- iSrcLen = 0;
- }
- Base64DecodePiece(srcData, iChars, dstData, iBytes);
- *pDstEnd++ = ((uint8_t*)&dstData)[0];
- if (iBytes > 1) {
- *pDstEnd++ = ((uint8_t*)&dstData)[1];
- }
- if (iBytes > 2) {
- *pDstEnd++ = ((uint8_t*)&dstData)[2];
- }
- }
- return pDstEnd - pDst;
-}
-
-} // namespace
-
-CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment)
- : m_pDocEnvironment(pDocEnvironment),
- m_pDocumentParser(nullptr),
- m_pApp(pApp),
- m_pNotify(nullptr),
- m_pPDFDoc(nullptr),
- m_dwDocType(XFA_DOCTYPE_Static) {}
-
-CXFA_FFDoc::~CXFA_FFDoc() {
- CloseDoc();
-}
-
-uint32_t CXFA_FFDoc::GetDocType() {
- return m_dwDocType;
-}
-
-int32_t CXFA_FFDoc::StartLoad() {
- m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this);
- m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get());
- return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
-}
-
-bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
- uint8_t*& pByteBuffer,
- int32_t& iBufferSize) {
- CFDE_XMLElement* pDocumentElement = nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFX_WideString wsTagName;
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetTagName(wsTagName);
- if (wsTagName == L"document") {
- pDocumentElement = pXMLElement;
- break;
- }
- }
- }
- if (!pDocumentElement) {
- return false;
- }
- CFDE_XMLElement* pChunkElement = nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFX_WideString wsTagName;
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetTagName(wsTagName);
- if (wsTagName == L"chunk") {
- pChunkElement = pXMLElement;
- break;
- }
- }
- }
- if (!pChunkElement) {
- return false;
- }
- CFX_WideString wsPDFContent;
- pChunkElement->GetTextData(wsPDFContent);
- iBufferSize =
- Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), nullptr);
- pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1);
- pByteBuffer[iBufferSize] = '0'; // FIXME: I bet this is wrong.
- Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), pByteBuffer);
- return true;
-}
-void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) {
- CXFA_Node* pChildNode = pNewRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChildNode) {
- CXFA_Node* pOriginChild =
- pOriginRoot->GetFirstChildByName(pChildNode->GetNameHash());
- if (pOriginChild) {
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- } else {
- CXFA_Node* pNextSibling =
- pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pNewRoot->RemoveChild(pChildNode);
- pOriginRoot->InsertChild(pChildNode);
- pChildNode = pNextSibling;
- pNextSibling = nullptr;
- }
- }
-}
-
-int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
- int32_t iStatus = m_pDocumentParser->DoParse(pPause);
- if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc)
- return XFA_PARSESTATUS_SyntaxErr;
- return iStatus;
-}
-
-void CXFA_FFDoc::StopLoad() {
- m_pApp->GetXFAFontMgr()->LoadDocFonts(this);
- m_dwDocType = XFA_DOCTYPE_Static;
- CXFA_Node* pConfig = ToNode(
- m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
- if (!pConfig) {
- return;
- }
- CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
- if (!pAcrobat) {
- return;
- }
- CXFA_Node* pAcrobat7 = pAcrobat->GetFirstChildByClass(XFA_Element::Acrobat7);
- if (!pAcrobat7) {
- return;
- }
- CXFA_Node* pDynamicRender =
- pAcrobat7->GetFirstChildByClass(XFA_Element::DynamicRender);
- if (!pDynamicRender) {
- return;
- }
- CFX_WideString wsType;
- if (pDynamicRender->TryContent(wsType) && wsType == L"required") {
- m_dwDocType = XFA_DOCTYPE_Dynamic;
- }
-}
-
-CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) {
- if (!m_TypeToDocViewMap[dwView])
- m_TypeToDocViewMap[dwView] = pdfium::MakeUnique<CXFA_FFDocView>(this);
-
- return m_TypeToDocViewMap[dwView].get();
-}
-
-CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) {
- for (const auto& pair : m_TypeToDocViewMap) {
- if (pair.second->GetXFALayout() == pLayout)
- return pair.second.get();
- }
- return nullptr;
-}
-
-CXFA_FFDocView* CXFA_FFDoc::GetDocView() {
- auto it = m_TypeToDocViewMap.begin();
- return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr;
-}
-
-bool CXFA_FFDoc::OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) {
- m_pStream = pStream;
- return true;
-}
-bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
- if (!pPDFDoc)
- return false;
-
- CPDF_Dictionary* pRoot = pPDFDoc->GetRoot();
- if (!pRoot)
- return false;
-
- CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
- if (!pAcroForm)
- return false;
-
- CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA");
- if (!pElementXFA)
- return false;
-
- std::vector<CPDF_Stream*> xfaStreams;
- if (pElementXFA->IsArray()) {
- CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA;
- for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) {
- if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1))
- xfaStreams.push_back(pStream);
- }
- } else if (pElementXFA->IsStream()) {
- xfaStreams.push_back((CPDF_Stream*)pElementXFA);
- }
- if (xfaStreams.empty())
- return false;
-
- m_pPDFDoc = pPDFDoc;
- m_pStream = MakeSeekableReadStream(xfaStreams);
- return true;
-}
-
-bool CXFA_FFDoc::CloseDoc() {
- for (const auto& pair : m_TypeToDocViewMap)
- pair.second->RunDocClose();
-
- CXFA_Document* doc =
- m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr;
- if (doc)
- doc->ClearLayoutData();
-
- m_TypeToDocViewMap.clear();
-
- m_pNotify.reset(nullptr);
- m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this);
-
- for (const auto& pair : m_HashToDibDpiMap)
- delete pair.second.pDibSource;
-
- m_HashToDibDpiMap.clear();
- m_pApp->ClearEventTargets();
- return true;
-}
-void CXFA_FFDoc::SetDocType(uint32_t dwType) {
- m_dwDocType = dwType;
-}
-CPDF_Document* CXFA_FFDoc::GetPDFDoc() {
- return m_pPDFDoc;
-}
-
-CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
- if (!m_pPDFDoc)
- return nullptr;
-
- uint32_t dwHash = FX_HashCode_GetW(wsName, false);
- auto it = m_HashToDibDpiMap.find(dwHash);
- if (it != m_HashToDibDpiMap.end()) {
- iImageXDpi = it->second.iImageXDpi;
- iImageYDpi = it->second.iImageYDpi;
- return static_cast<CFX_DIBitmap*>(it->second.pDibSource);
- }
-
- CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
- if (!pRoot)
- return nullptr;
-
- CPDF_Dictionary* pNames = pRoot->GetDictFor("Names");
- if (!pNames)
- return nullptr;
-
- CPDF_Dictionary* pXFAImages = pNames->GetDictFor("XFAImages");
- if (!pXFAImages)
- return nullptr;
-
- CPDF_NameTree nametree(pXFAImages);
- CFX_ByteString bsName = PDF_EncodeText(wsName.c_str(), wsName.GetLength());
- CPDF_Object* pObject = nametree.LookupValue(bsName);
- if (!pObject) {
- for (size_t i = 0; i < nametree.GetCount(); i++) {
- CFX_ByteString bsTemp;
- CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp);
- if (bsTemp == bsName) {
- pObject = pTempObject;
- break;
- }
- }
- }
-
- CPDF_Stream* pStream = ToStream(pObject);
- if (!pStream)
- return nullptr;
-
- CPDF_StreamAcc streamAcc;
- streamAcc.LoadAllData(pStream);
-
- CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead =
- IFX_MemoryStream::Create((uint8_t*)streamAcc.GetData(),
- streamAcc.GetSize());
-
- CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer(
- pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
- m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi};
- return pDibSource;
-}
-
-bool CXFA_FFDoc::SavePackage(
- XFA_HashCode code,
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
- CXFA_ChecksumContext* pCSContext) {
- CXFA_Document* doc = m_pDocumentParser->GetDocument();
- std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc));
- CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot()
- : ToNode(doc->GetXFAObject(code));
- if (!pNode)
- return !!pExport->Export(pFile);
-
- CFX_ByteString bsChecksum;
- if (pCSContext)
- bsChecksum = pCSContext->GetChecksum();
-
- return !!pExport->Export(
- pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
-}
-
-bool CXFA_FFDoc::ImportData(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pStream,
- bool bXDP) {
- auto importer =
- pdfium::MakeUnique<CXFA_DataImporter>(m_pDocumentParser->GetDocument());
- return importer->ImportData(pStream);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp
deleted file mode 100644
index db73531ccc5..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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/fxfa/xfa_ffdochandler.h"
-
-#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#include "xfa/fxfa/xfa_checksum.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-
-CXFA_FFDocHandler::CXFA_FFDocHandler() {}
-
-CXFA_FFDocHandler::~CXFA_FFDocHandler() {}
-
-CFXJSE_Value* CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) {
- CXFA_Document* pXFADoc = hDoc->GetXFADoc();
- if (!pXFADoc)
- return nullptr;
-
- CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext();
- if (!pScriptContext)
- return nullptr;
- return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot());
-}
-
-XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) {
- CXFA_Document* pXFADoc = hDoc->GetXFADoc();
- if (!pXFADoc)
- return XFA_ATTRIBUTEENUM_Unknown;
-
- CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form));
- if (!pForm)
- return XFA_ATTRIBUTEENUM_Unknown;
-
- CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_Element::Subform);
- if (!pSubForm)
- return XFA_ATTRIBUTEENUM_Unknown;
- return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState);
-}
-
-bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc,
- XFA_SCRIPTTYPE eScriptType,
- const CFX_WideStringC& wsScript,
- CFXJSE_Value* pRetValue,
- CFXJSE_Value* pThisValue) {
- CXFA_Document* pXFADoc = hDoc->GetXFADoc();
- if (!pXFADoc)
- return false;
-
- CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext();
- if (!pScriptContext)
- return false;
-
- return pScriptContext->RunScript(
- (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, pRetValue,
- pThisValue ? CXFA_ScriptContext::ToObject(pThisValue, nullptr) : nullptr);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp
deleted file mode 100644
index 87441814e53..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp
+++ /dev/null
@@ -1,850 +0,0 @@
-// 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/fxfa/xfa_ffdocview.h"
-
-#include "core/fxcrt/fx_ext.h"
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffbarcode.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimage.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpath.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_ffsignature.h"
-#include "xfa/fxfa/app/xfa_ffsubform.h"
-#include "xfa/fxfa/app/xfa_fftext.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/parser/cxfa_binditems.h"
-#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
-#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-
-const XFA_ATTRIBUTEENUM gs_EventActivity[] = {
- XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change,
- XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady,
- XFA_ATTRIBUTEENUM_Enter, XFA_ATTRIBUTEENUM_Exit,
- XFA_ATTRIBUTEENUM_Full, XFA_ATTRIBUTEENUM_IndexChange,
- XFA_ATTRIBUTEENUM_Initialize, XFA_ATTRIBUTEENUM_MouseDown,
- XFA_ATTRIBUTEENUM_MouseEnter, XFA_ATTRIBUTEENUM_MouseExit,
- XFA_ATTRIBUTEENUM_MouseUp, XFA_ATTRIBUTEENUM_PostExecute,
- XFA_ATTRIBUTEENUM_PostOpen, XFA_ATTRIBUTEENUM_PostPrint,
- XFA_ATTRIBUTEENUM_PostSave, XFA_ATTRIBUTEENUM_PostSign,
- XFA_ATTRIBUTEENUM_PostSubmit, XFA_ATTRIBUTEENUM_PreExecute,
- XFA_ATTRIBUTEENUM_PreOpen, XFA_ATTRIBUTEENUM_PrePrint,
- XFA_ATTRIBUTEENUM_PreSave, XFA_ATTRIBUTEENUM_PreSign,
- XFA_ATTRIBUTEENUM_PreSubmit, XFA_ATTRIBUTEENUM_Ready,
- XFA_ATTRIBUTEENUM_Unknown,
-};
-
-CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc)
- : m_bLayoutEvent(false),
- m_pListFocusWidget(nullptr),
- m_bInLayoutStatus(false),
- m_pDoc(pDoc),
- m_pXFADocLayout(nullptr),
- m_pFocusAcc(nullptr),
- m_pFocusWidget(nullptr),
- m_pOldFocusWidget(nullptr),
- m_iStatus(XFA_DOCVIEW_LAYOUTSTATUS_None),
- m_iLock(0) {}
-
-CXFA_FFDocView::~CXFA_FFDocView() {
- DestroyDocView();
-}
-
-void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
- RunBindItems();
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize, false, true,
- nullptr);
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange, false, true,
- nullptr);
-}
-int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) {
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
- m_pDoc->GetXFADoc()->DoProtoMerge();
- m_pDoc->GetXFADoc()->DoDataMerge();
- m_pXFADocLayout = GetXFALayout();
- int32_t iStatus = m_pXFADocLayout->StartLayout();
- if (iStatus < 0) {
- return iStatus;
- }
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return iStatus;
- }
- InitLayout(pRootItem);
- InitCalculate(pRootItem);
- InitValidate(pRootItem);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, true, true, nullptr);
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
- return iStatus;
-}
-int32_t CXFA_FFDocView::DoLayout(IFX_Pause* pPause) {
- int32_t iStatus = 100;
- iStatus = m_pXFADocLayout->DoLayout(pPause);
- if (iStatus != 100) {
- return iStatus;
- }
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Doing;
- return iStatus;
-}
-void CXFA_FFDocView::StopLayout() {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return;
- }
- CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform);
- if (!pSubformNode) {
- return;
- }
- CXFA_Node* pPageSetNode =
- pSubformNode->GetFirstChildByClass(XFA_Element::PageSet);
- if (!pPageSetNode) {
- return;
- }
- RunCalculateWidgets();
- RunValidate();
- InitLayout(pPageSetNode);
- InitCalculate(pPageSetNode);
- InitValidate(pPageSetNode);
- ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, true, true,
- nullptr);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady, false, true,
- nullptr);
- RunCalculateWidgets();
- RunValidate();
- if (RunLayout()) {
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- }
- m_CalculateAccs.clear();
- if (m_pFocusAcc && !m_pFocusWidget) {
- SetFocusWidgetAcc(m_pFocusAcc);
- }
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End;
-}
-int32_t CXFA_FFDocView::GetLayoutStatus() {
- return m_iStatus;
-}
-void CXFA_FFDocView::ShowNullTestMsg() {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_arrNullTestMsg);
- CXFA_FFApp* pApp = m_pDoc->GetApp();
- IXFA_AppProvider* pAppProvider = pApp->GetAppProvider();
- if (pAppProvider && iCount) {
- int32_t iRemain = iCount > 7 ? iCount - 7 : 0;
- iCount -= iRemain;
- CFX_WideString wsMsg;
- for (int32_t i = 0; i < iCount; i++) {
- wsMsg += m_arrNullTestMsg[i] + L"\n";
- }
- if (iRemain > 0) {
- CFX_WideString wsTemp;
- wsTemp.Format(
- L"Message limit exceeded. Remaining %d "
- L"validation errors not reported.",
- iRemain);
- wsMsg += L"\n" + wsTemp;
- }
- pAppProvider->MsgBox(wsMsg, pAppProvider->GetAppTitle(), XFA_MBICON_Status,
- XFA_MB_OK);
- }
- m_arrNullTestMsg.clear();
-}
-
-void CXFA_FFDocView::UpdateDocView() {
- if (IsUpdateLocked())
- return;
-
- LockUpdate();
- for (CXFA_Node* pNode : m_NewAddedNodes) {
- InitCalculate(pNode);
- InitValidate(pNode);
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, true, true, nullptr);
- }
- m_NewAddedNodes.clear();
- RunSubformIndexChange();
- RunCalculateWidgets();
- RunValidate();
- ShowNullTestMsg();
- if (RunLayout() && m_bLayoutEvent)
- RunEventLayoutReady();
-
- m_bLayoutEvent = false;
- m_CalculateAccs.clear();
- RunInvalidate();
- UnlockUpdate();
-}
-
-int32_t CXFA_FFDocView::CountPageViews() {
- if (!m_pXFADocLayout) {
- return 0;
- }
- return m_pXFADocLayout->CountPages();
-}
-CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) {
- if (!m_pXFADocLayout) {
- return nullptr;
- }
- return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex));
-}
-
-CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const {
- return m_pDoc->GetXFADoc()->GetDocLayout();
-}
-bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_Node* pNode = pWidgetAcc->GetNode();
- XFA_Element eType = pNode->GetElementType();
- if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) {
- return false;
- }
- pWidgetAcc->ResetData();
- pWidgetAcc->UpdateUIDisplay();
- if (CXFA_Validate validate = pWidgetAcc->GetValidate()) {
- AddValidateWidget(pWidgetAcc);
- validate.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
- }
- return true;
-}
-void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) {
- m_bLayoutEvent = true;
- bool bChanged = false;
- CXFA_Node* pFormNode = nullptr;
- if (pWidgetAcc) {
- bChanged = ResetSingleWidgetAccData(pWidgetAcc);
- pFormNode = pWidgetAcc->GetNode();
- } else {
- pFormNode = GetRootSubform();
- }
- if (!pFormNode) {
- return;
- }
- if (pFormNode->GetElementType() != XFA_Element::Field &&
- pFormNode->GetElementType() != XFA_Element::ExclGroup) {
- CXFA_WidgetAccIterator Iterator(this, pFormNode);
- while (CXFA_WidgetAcc* pAcc = Iterator.MoveToNext()) {
- bChanged |= ResetSingleWidgetAccData(pAcc);
- if (pAcc->GetNode()->GetElementType() == XFA_Element::ExclGroup) {
- Iterator.SkipTree();
- }
- }
- }
- if (bChanged) {
- m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
- }
-}
-int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
- CXFA_WidgetAcc* pWidgetAcc) {
- if (!pParam)
- return XFA_EVENTERROR_Error;
-
- if (pParam->m_eType == XFA_EVENT_Validate) {
- CFX_WideString wsValidateStr(L"preSubmit");
- CXFA_Node* pConfigItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config));
- if (pConfigItem) {
- CXFA_Node* pValidateNode = nullptr;
- CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_Element::Acrobat);
- pValidateNode = pAcrobatNode
- ? pAcrobatNode->GetChild(0, XFA_Element::Validate)
- : nullptr;
- if (!pValidateNode) {
- CXFA_Node* pPresentNode =
- pConfigItem->GetChild(0, XFA_Element::Present);
- pValidateNode = pPresentNode
- ? pPresentNode->GetChild(0, XFA_Element::Validate)
- : nullptr;
- }
- if (pValidateNode) {
- wsValidateStr = pValidateNode->GetContent();
- }
- }
- bool bValidate = false;
- switch (pParam->m_iValidateActivities) {
- case XFA_VALIDATE_preSubmit:
- bValidate = wsValidateStr.Find(L"preSubmit") != -1;
- break;
- case XFA_VALIDATE_prePrint:
- bValidate = wsValidateStr.Find(L"prePrint") != -1;
- break;
- case XFA_VALIDATE_preExecute:
- bValidate = wsValidateStr.Find(L"preExecute") != -1;
- break;
- case XFA_VALIDATE_preSave:
- bValidate = wsValidateStr.Find(L"preSave") != -1;
- break;
- }
- if (!bValidate) {
- return XFA_EVENTERROR_Success;
- }
- }
- CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : nullptr;
- if (!pNode) {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return XFA_EVENTERROR_Error;
- }
- pNode = pRootItem->GetChild(0, XFA_Element::Subform);
- }
- ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady,
- true, nullptr);
- return XFA_EVENTERROR_Success;
-}
-CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() {
- if (!m_pWidgetHandler)
- m_pWidgetHandler = pdfium::MakeUnique<CXFA_FFWidgetHandler>(this);
-
- return m_pWidgetHandler.get();
-}
-
-CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator(
- XFA_WIDGETORDER eOrder) {
- CXFA_Node* pFormRoot = GetRootSubform();
- return pFormRoot ? new CXFA_WidgetAccIterator(this, pFormRoot) : nullptr;
-}
-CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() {
- return m_pFocusWidget;
-}
-void CXFA_FFDocView::KillFocus() {
- if (m_pFocusWidget &&
- (m_pFocusWidget->GetStatus() & XFA_WidgetStatus_Focused)) {
- (m_pFocusWidget)->OnKillFocus(nullptr);
- }
- m_pFocusAcc = nullptr;
- m_pFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
-}
-bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
- CXFA_FFWidget* pNewFocus = hWidget;
- if (m_pOldFocusWidget == pNewFocus) {
- return false;
- }
- CXFA_FFWidget* pOldFocus = m_pOldFocusWidget;
- m_pOldFocusWidget = pNewFocus;
- if (pOldFocus) {
- if (m_pFocusWidget != m_pOldFocusWidget &&
- (pOldFocus->GetStatus() & XFA_WidgetStatus_Focused)) {
- m_pFocusWidget = pOldFocus;
- pOldFocus->OnKillFocus(pNewFocus);
- } else if ((pOldFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
- if (!pOldFocus->IsLoaded()) {
- pOldFocus->LoadWidget();
- }
- pOldFocus->OnSetFocus(m_pFocusWidget);
- m_pFocusWidget = pOldFocus;
- pOldFocus->OnKillFocus(pNewFocus);
- }
- }
- if (m_pFocusWidget == m_pOldFocusWidget) {
- return false;
- }
- pNewFocus = m_pOldFocusWidget;
- if (m_pListFocusWidget && pNewFocus == m_pListFocusWidget) {
- m_pFocusAcc = nullptr;
- m_pFocusWidget = nullptr;
- m_pListFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
- return false;
- }
- if (pNewFocus && (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
- if (!pNewFocus->IsLoaded()) {
- pNewFocus->LoadWidget();
- }
- pNewFocus->OnSetFocus(m_pFocusWidget);
- }
- m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : nullptr;
- m_pFocusWidget = pNewFocus;
- m_pOldFocusWidget = m_pFocusWidget;
- return true;
-}
-CXFA_WidgetAcc* CXFA_FFDocView::GetFocusWidgetAcc() {
- return m_pFocusAcc;
-}
-void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_FFWidget* pNewFocus =
- pWidgetAcc ? pWidgetAcc->GetNextWidget(nullptr) : nullptr;
- if (SetFocus(pNewFocus)) {
- m_pFocusAcc = pWidgetAcc;
- if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) {
- m_pDoc->GetDocEnvironment()->SetFocusWidget(m_pDoc, m_pFocusWidget);
- }
- }
-}
-void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
- if (m_pFocusAcc == pWidget->GetDataAcc()) {
- m_pFocusAcc = nullptr;
- m_pFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
- }
-}
-static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
- CXFA_WidgetAcc* pWidgetAcc,
- CXFA_EventParam* pParam) {
- if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) {
- return XFA_EVENTERROR_NotExist;
- }
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw) {
- return XFA_EVENTERROR_NotExist;
- }
- switch (pParam->m_eType) {
- case XFA_EVENT_Calculate:
- return pWidgetAcc->ProcessCalculate();
- case XFA_EVENT_Validate:
- if (((CXFA_FFDoc*)pDocView->GetDoc())
- ->GetDocEnvironment()
- ->IsValidationsEnabled(pDocView->GetDoc())) {
- return pWidgetAcc->ProcessValidate(0x01);
- }
- return XFA_EVENTERROR_Disabled;
- case XFA_EVENT_InitCalculate: {
- CXFA_Calculate calc = pWidgetAcc->GetCalculate();
- if (!calc) {
- return XFA_EVENTERROR_NotExist;
- }
- if (pWidgetAcc->GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_Disabled;
-
- CXFA_Script script = calc.GetScript();
- return pWidgetAcc->ExecuteScript(script, pParam);
- }
- default:
- break;
- }
- int32_t iRet =
- pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
- return iRet;
-}
-int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
- XFA_EVENTTYPE eEventType,
- bool bIsFormReady,
- bool bRecursive,
- CXFA_Node* pExclude) {
- int32_t iRet = XFA_EVENTERROR_NotExist;
- if (pFormNode == pExclude) {
- return iRet;
- }
- XFA_Element elementType = pFormNode->GetElementType();
- if (elementType == XFA_Element::Field) {
- if (eEventType == XFA_EVENT_IndexChange) {
- return iRet;
- }
- CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
- if (!pWidgetAcc) {
- return iRet;
- }
- CXFA_EventParam eParam;
- eParam.m_eType = eEventType;
- eParam.m_pTarget = pWidgetAcc;
- eParam.m_bIsFormReady = bIsFormReady;
- return XFA_ProcessEvent(this, pWidgetAcc, &eParam);
- }
- if (bRecursive) {
- for (CXFA_Node* pNode = pFormNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
- pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode)) {
- elementType = pNode->GetElementType();
- if (elementType != XFA_Element::Variables &&
- elementType != XFA_Element::Draw) {
- iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
- bRecursive, pExclude);
- }
- }
- }
- CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
- if (!pWidgetAcc) {
- return iRet;
- }
- CXFA_EventParam eParam;
- eParam.m_eType = eEventType;
- eParam.m_pTarget = pWidgetAcc;
- eParam.m_bIsFormReady = bIsFormReady;
- iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam);
- return iRet;
-}
-
-CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName,
- CXFA_FFWidget* pRefWidget) {
- CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr;
- CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
- return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
- const CFX_WideString& wsName,
- CXFA_WidgetAcc* pRefWidgetAcc) {
- CFX_WideString wsExpression;
- uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
- XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
- CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
- if (!pScriptContext) {
- return nullptr;
- }
- CXFA_Node* refNode = nullptr;
- if (pRefWidgetAcc) {
- refNode = pRefWidgetAcc->GetNode();
- wsExpression = wsName;
- } else {
- wsExpression = L"$form." + wsName;
- }
- XFA_RESOLVENODE_RS resoveNodeRS;
- int32_t iRet = pScriptContext->ResolveObjects(
- refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle);
- if (iRet < 1) {
- return nullptr;
- }
- if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode();
- if (pNode) {
- return (CXFA_WidgetAcc*)pNode->GetWidgetData();
- }
- }
- return nullptr;
-}
-
-void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
- uint32_t dwEvent) {
- CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender);
- m_pDoc->GetDocEnvironment()->PageViewEvent(pFFPageView, dwEvent);
-}
-
-void CXFA_FFDocView::LockUpdate() {
- m_iLock++;
-}
-void CXFA_FFDocView::UnlockUpdate() {
- m_iLock--;
-}
-bool CXFA_FFDocView::IsUpdateLocked() {
- return m_iLock > 0;
-}
-void CXFA_FFDocView::ClearInvalidateList() {
- m_mapPageInvalidate.clear();
-}
-void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget,
- const CFX_RectF& rtInvalidate) {
- AddInvalidateRect(pWidget->GetPageView(), rtInvalidate);
-}
-
-void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rtInvalidate) {
- if (m_mapPageInvalidate[pPageView]) {
- m_mapPageInvalidate[pPageView]->Union(rtInvalidate);
- return;
- }
- m_mapPageInvalidate[pPageView] = pdfium::MakeUnique<CFX_RectF>(rtInvalidate);
-}
-
-void CXFA_FFDocView::RunInvalidate() {
- for (const auto& pair : m_mapPageInvalidate)
- m_pDoc->GetDocEnvironment()->InvalidateRect(pair.first, *pair.second, 0);
- m_mapPageInvalidate.clear();
-}
-
-bool CXFA_FFDocView::RunLayout() {
- LockUpdate();
- m_bInLayoutStatus = true;
- if (!m_pXFADocLayout->IncrementLayout() &&
- m_pXFADocLayout->StartLayout() < 100) {
- m_pXFADocLayout->DoLayout();
- UnlockUpdate();
- m_bInLayoutStatus = false;
- m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr,
- XFA_PAGEVIEWEVENT_StopLayout);
- return true;
- }
- m_bInLayoutStatus = false;
- m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr,
- XFA_PAGEVIEWEVENT_StopLayout);
- UnlockUpdate();
- return false;
-}
-
-void CXFA_FFDocView::RunSubformIndexChange() {
- for (CXFA_Node* pSubformNode : m_IndexChangedSubforms) {
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pSubformNode->GetWidgetData());
- if (!pWidgetAcc)
- continue;
-
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_IndexChange;
- eParam.m_pTarget = pWidgetAcc;
- pWidgetAcc->ProcessEvent(XFA_ATTRIBUTEENUM_IndexChange, &eParam);
- }
- m_IndexChangedSubforms.clear();
-}
-
-void CXFA_FFDocView::AddNewFormNode(CXFA_Node* pNode) {
- m_NewAddedNodes.push_back(pNode);
- InitLayout(pNode);
-}
-
-void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) {
- ASSERT(pNode->GetElementType() == XFA_Element::Subform);
- m_IndexChangedSubforms.push_back(pNode);
-}
-
-void CXFA_FFDocView::RunDocClose() {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return;
- }
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose, false, true,
- nullptr);
-}
-void CXFA_FFDocView::DestroyDocView() {
- ClearInvalidateList();
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_None;
- m_iLock = 0;
- m_ValidateAccs.clear();
- m_BindItems.clear();
- m_CalculateAccs.clear();
-}
-bool CXFA_FFDocView::IsStaticNotify() {
- return m_pDoc->GetDocType() == XFA_DOCTYPE_Static;
-}
-
-void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_WidgetAcc* pCurrentAcc =
- !m_CalculateAccs.empty() ? m_CalculateAccs.back() : nullptr;
- if (pCurrentAcc != pWidgetAcc)
- m_CalculateAccs.push_back(pWidgetAcc);
-}
-
-void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
- auto pGlobalData =
- static_cast<CXFA_CalcData*>(pNodeChange->GetUserData(XFA_CalcData));
- if (!pGlobalData)
- return;
-
- for (const auto& pResultAcc : pGlobalData->m_Globals) {
- if (!pResultAcc->GetNode()->HasRemovedChildren())
- AddCalculateWidgetAcc(pResultAcc);
- }
-}
-
-void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) {
- while (iIndex < pdfium::CollectionSize<int32_t>(m_CalculateAccs)) {
- CXFA_WidgetAcc* pCurAcc = m_CalculateAccs[iIndex];
- AddCalculateNodeNotify(pCurAcc->GetNode());
- int32_t iRefCount =
- (int32_t)(uintptr_t)pCurAcc->GetNode()->GetUserData(XFA_CalcRefCount);
- iRefCount++;
- pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount,
- (void*)(uintptr_t)iRefCount);
- if (iRefCount > 11) {
- break;
- }
- if ((pCurAcc->ProcessCalculate()) == XFA_EVENTERROR_Success) {
- AddValidateWidget(pCurAcc);
- }
- iIndex++;
- RunCalculateRecursive(iIndex);
- }
-}
-
-int32_t CXFA_FFDocView::RunCalculateWidgets() {
- if (!m_pDoc->GetDocEnvironment()->IsCalculationsEnabled(m_pDoc)) {
- return XFA_EVENTERROR_Disabled;
- }
- int32_t iCounts = pdfium::CollectionSize<int32_t>(m_CalculateAccs);
- int32_t iIndex = 0;
- if (iCounts > 0)
- RunCalculateRecursive(iIndex);
-
- for (CXFA_WidgetAcc* pCurAcc : m_CalculateAccs)
- pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (void*)(uintptr_t)0);
-
- m_CalculateAccs.clear();
- return XFA_EVENTERROR_Success;
-}
-
-void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) {
- if (!pdfium::ContainsValue(m_ValidateAccs, pWidget))
- m_ValidateAccs.push_back(pWidget);
-}
-
-bool CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) {
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate, false, true,
- nullptr);
- return true;
-}
-
-bool CXFA_FFDocView::InitValidate(CXFA_Node* pNode) {
- if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc))
- return false;
-
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, false, true, nullptr);
- m_ValidateAccs.clear();
- return true;
-}
-
-bool CXFA_FFDocView::RunValidate() {
- if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc))
- return false;
-
- for (CXFA_WidgetAcc* pAcc : m_ValidateAccs) {
- if (!pAcc->GetNode()->HasRemovedChildren())
- pAcc->ProcessValidate();
- }
- m_ValidateAccs.clear();
- return true;
-}
-bool CXFA_FFDocView::RunEventLayoutReady() {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return false;
- }
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- RunLayout();
- return true;
-}
-void CXFA_FFDocView::RunBindItems() {
- for (const auto& item : m_BindItems) {
- if (item->HasRemovedChildren())
- continue;
-
- CXFA_Node* pWidgetNode = item->GetNodeItem(XFA_NODEITEM_Parent);
- CXFA_WidgetAcc* pAcc =
- static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
- if (!pAcc)
- continue;
-
- CXFA_BindItems binditems(item);
- CXFA_ScriptContext* pScriptContext =
- pWidgetNode->GetDocument()->GetScriptContext();
- CFX_WideStringC wsRef;
- binditems.GetRef(wsRef);
- uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
- XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent |
- XFA_RESOLVENODE_ALL;
- XFA_RESOLVENODE_RS rs;
- pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle);
- int32_t iCount = rs.nodes.GetSize();
- pAcc->DeleteItem(-1);
- if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1)
- continue;
-
- CFX_WideStringC wsValueRef, wsLabelRef;
- binditems.GetValueRef(wsValueRef);
- binditems.GetLabelRef(wsLabelRef);
- const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
- const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == L"$";
- const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$";
- CFX_WideString wsValue;
- CFX_WideString wsLabel;
- uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
- for (int32_t j = 0; j < iCount; j++) {
- CXFA_Object* refObj = rs.nodes[j];
- if (!refObj->IsNode()) {
- continue;
- }
- CXFA_Node* refNode = refObj->AsNode();
- if (bValueUseContent) {
- wsValue = refNode->GetContent();
- } else {
- CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash);
- wsValue = nodeValue ? nodeValue->GetContent() : refNode->GetContent();
- }
- if (!bUseValue) {
- if (bLabelUseContent) {
- wsLabel = refNode->GetContent();
- } else {
- CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef);
- if (nodeLabel)
- wsLabel = nodeLabel->GetContent();
- }
- } else {
- wsLabel = wsValue;
- }
- pAcc->InsertItem(wsLabel, wsValue);
- }
- }
- m_BindItems.clear();
-}
-void CXFA_FFDocView::SetChangeMark() {
- if (m_iStatus < XFA_DOCVIEW_LAYOUTSTATUS_End) {
- return;
- }
- m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
-}
-CXFA_Node* CXFA_FFDocView::GetRootSubform() {
- CXFA_Node* pFormPacketNode =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pFormPacketNode) {
- return nullptr;
- }
- return pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform);
-}
-
-CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView,
- CXFA_Node* pTravelRoot)
- : m_ContentIterator(pTravelRoot),
- m_pDocView(pDocView),
- m_pCurWidgetAcc(nullptr) {}
-
-CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {}
-void CXFA_WidgetAccIterator::Reset() {
- m_pCurWidgetAcc = nullptr;
- m_ContentIterator.Reset();
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToFirst() {
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToLast() {
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() {
- CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext()
- : m_ContentIterator.GetCurrent();
- while (pItem) {
- m_pCurWidgetAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
- if (m_pCurWidgetAcc)
- return m_pCurWidgetAcc;
- pItem = m_ContentIterator.MoveToNext();
- }
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToPrevious() {
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() {
- return nullptr;
-}
-
-bool CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) {
- return false;
-}
-
-void CXFA_WidgetAccIterator::SkipTree() {
- m_ContentIterator.SkipChildrenAndMoveToNext();
- m_pCurWidgetAcc = nullptr;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp
index 37095ddb49b..8742b83c5bf 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp
@@ -6,10 +6,10 @@
#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFDraw::CXFA_FFDraw(CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h
index 0212dcca0a7..bcd74f204c8 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h
@@ -7,8 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFDRAW_H_
#define XFA_FXFA_APP_XFA_FFDRAW_H_
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
class CXFA_FFDraw : public CXFA_FFWidget {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp
index 7d63daddbc7..9f2560f82fb 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp
@@ -6,10 +6,10 @@
#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFWidget(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h
index 12a13aea92c..a14894566c4 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h
@@ -7,8 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
#define XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
class CXFA_FFExclGroup : public CXFA_FFWidget {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp
index 630d04311fb..4193af82b48 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp
@@ -17,11 +17,12 @@
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
@@ -94,7 +95,7 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
if (m_dwStatus & XFA_WidgetStatus_Focused) {
CFX_Color cr(0xFF000000);
pGS->SetStrokeColor(&cr);
- FX_FLOAT DashPattern[2] = {1, 1};
+ float DashPattern[2] = {1, 1};
pGS->SetLineDash(0.0f, DashPattern, 2);
pGS->SetLineWidth(0, false);
@@ -124,7 +125,7 @@ void CXFA_FFField::SetEditScrollOffset() {
XFA_Element eType = m_pDataAcc->GetUIType();
if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit ||
eType == XFA_Element::PasswordEdit) {
- FX_FLOAT fScrollOffset = 0;
+ float fScrollOffset = 0;
CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev());
if (pPrev) {
CFX_RectF rtMargin = m_pDataAcc->GetUIMargin();
@@ -153,7 +154,7 @@ void CXFA_FFField::CapPlacement() {
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
if (mgWidget) {
CXFA_LayoutItem* pItem = this;
- FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
+ float fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
mgWidget.GetTopInset(fTopInset);
@@ -171,7 +172,7 @@ void CXFA_FFField::CapPlacement() {
}
XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
- FX_FLOAT fCapReserve = 0;
+ float fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
@@ -260,8 +261,8 @@ void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption,
m_rtCaption.top += m_rtCaption.height;
}
}
- FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width;
- FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height;
+ float fWidth = rtUIMargin.left + rtUIMargin.width;
+ float fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height;
if (fWidth > rtWidget.width) {
m_rtUI.width += fWidth - rtWidget.width;
}
@@ -287,8 +288,8 @@ void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption,
m_rtCaption.top += m_rtCaption.height;
}
}
- FX_FLOAT fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width;
- FX_FLOAT fHeight = rtUIMargin.top + rtUIMargin.height;
+ float fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width;
+ float fHeight = rtUIMargin.top + rtUIMargin.height;
if (fWidth > rtWidget.width) {
m_rtUI.width += fWidth - rtWidget.width;
if (iCapPlacement == XFA_ATTRIBUTEENUM_Right) {
@@ -323,7 +324,7 @@ void CXFA_FFField::SetFWLRect() {
if (rtUi.width < 1.0)
rtUi.width = 1.0;
if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
- FX_FLOAT fFontSize = m_pDataAcc->GetFontSize();
+ float fFontSize = m_pDataAcc->GetFontSize();
if (rtUi.height < fFontSize) {
rtUi.height = fFontSize;
}
@@ -563,7 +564,7 @@ void CXFA_FFField::LayoutCaption() {
if (!pCapTextLayout)
return;
- FX_FLOAT fHeight = 0;
+ float fHeight = 0;
pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height),
&fHeight);
if (m_rtCaption.height < fHeight)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h
index f10ce617388..0e9ac8661c2 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h
@@ -9,8 +9,8 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/ifwl_widgetdelegate.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#define XFA_MINUI_HEIGHT 4.32f
#define XFA_DEFAULTUI_HEIGHT 2.0f
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp
index a613221ea63..23ed88616d8 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp
@@ -7,10 +7,10 @@
#include "xfa/fxfa/app/xfa_ffimage.h"
#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFImage::CXFA_FFImage(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
@@ -43,7 +43,7 @@ void CXFA_FFImage::RenderWidget(CFX_Graphics* pGS,
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
- CFX_DIBitmap* pDIBitmap = GetDataAcc()->GetImageImage();
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = GetDataAcc()->GetImageImage();
if (!pDIBitmap)
return;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp
index 01d29eed419..624ef3f4426 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -11,10 +11,10 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_picturebox.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -60,7 +60,7 @@ void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS,
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
- CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage();
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDataAcc->GetImageEditImage();
if (!pDIBitmap)
return;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h
index 73032b98150..ee91a772e00 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h
@@ -26,7 +26,7 @@ class CXFA_FFImageEdit : public CXFA_FFField {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
- protected:
+ private:
void SetFWLRect() override;
bool UpdateFWLData() override;
bool CommitData() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp
index 951b4fd3f1d..d9ec99aba9f 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -24,12 +24,13 @@
#include "xfa/fxfa/app/xfa_fftextedit.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
static void XFA_FFDeleteWidgetAcc(void* pData) {
delete static_cast<CXFA_WidgetAcc*>(pData);
@@ -49,8 +50,8 @@ void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
}
void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender,
- const FX_WCHAR* pLabel,
- const FX_WCHAR* pValue,
+ const wchar_t* pLabel,
+ const wchar_t* pValue,
int32_t iIndex) {
CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList)
@@ -171,8 +172,8 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
}
void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
- FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight) {
+ float& fCalcWidth,
+ float& fCalcHeight) {
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
if (!pAcc)
return;
@@ -182,7 +183,7 @@ void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem,
int32_t iBlockIndex,
- FX_FLOAT& fCalcHeightPos) {
+ float& fCalcHeightPos) {
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
return pAcc && pAcc->FindSplitPos(iBlockIndex, fCalcHeightPos);
}
@@ -262,8 +263,9 @@ void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) {
pDocView->UpdateDocView();
}
CFX_WideString CXFA_FFNotify::GetCurrentDateTime() {
- CFX_Unitime dataTime;
+ CFX_DateTime dataTime;
dataTime.Now();
+
CFX_WideString wsDateTime;
wsDateTime.Format(L"%d%02d%02dT%02d%02d%02d", dataTime.GetYear(),
dataTime.GetMonth(), dataTime.GetDay(), dataTime.GetHour(),
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h
index 1bfaffec896..c002ed4c156 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h
@@ -20,8 +20,8 @@ class CXFA_FFNotify {
void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
void OnWidgetListItemAdded(CXFA_WidgetData* pSender,
- const FX_WCHAR* pLabel,
- const FX_WCHAR* pValue,
+ const wchar_t* pLabel,
+ const wchar_t* pValue,
int32_t iIndex);
void OnWidgetListItemRemoved(CXFA_WidgetData* pSender, int32_t iIndex);
@@ -44,11 +44,11 @@ class CXFA_FFNotify {
CXFA_LayoutItem* pSender);
void StartFieldDrawLayout(CXFA_Node* pItem,
- FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight);
+ float& fCalcWidth,
+ float& fCalcHeight);
bool FindSplitPos(CXFA_Node* pItem,
int32_t iBlockIndex,
- FX_FLOAT& fCalcHeightPos);
+ float& fCalcHeightPos);
bool RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem);
int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp
deleted file mode 100644
index 7ae5493ba60..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-// 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/fxfa/xfa_ffpageview.h"
-
-#include <memory>
-#include <vector>
-
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fde/fde_render.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-
-namespace {
-
-CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect,
- const CFX_Rect& devicePageRect,
- int32_t iRotate,
- uint32_t dwCoordinatesType) {
- ASSERT(iRotate >= 0 && iRotate <= 3);
-
- bool bFlipX = (dwCoordinatesType & 0x01) != 0;
- bool bFlipY = (dwCoordinatesType & 0x02) != 0;
- CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
- if (iRotate == 0 || iRotate == 2) {
- m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width;
- m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height;
- } else {
- m.a *= (FX_FLOAT)devicePageRect.height / docPageRect.width;
- m.d *= (FX_FLOAT)devicePageRect.width / docPageRect.height;
- }
- m.Rotate(iRotate * 1.57079632675f);
- switch (iRotate) {
- case 0:
- m.e = bFlipX ? (FX_FLOAT)devicePageRect.right()
- : (FX_FLOAT)devicePageRect.left;
- m.f = bFlipY ? (FX_FLOAT)devicePageRect.bottom()
- : (FX_FLOAT)devicePageRect.top;
- break;
- case 1:
- m.e = bFlipY ? (FX_FLOAT)devicePageRect.left
- : (FX_FLOAT)devicePageRect.right();
- m.f = bFlipX ? (FX_FLOAT)devicePageRect.bottom()
- : (FX_FLOAT)devicePageRect.top;
- break;
- case 2:
- m.e = bFlipX ? (FX_FLOAT)devicePageRect.left
- : (FX_FLOAT)devicePageRect.right();
- m.f = bFlipY ? (FX_FLOAT)devicePageRect.top
- : (FX_FLOAT)devicePageRect.bottom();
- break;
- case 3:
- m.e = bFlipY ? (FX_FLOAT)devicePageRect.right()
- : (FX_FLOAT)devicePageRect.left;
- m.f = bFlipX ? (FX_FLOAT)devicePageRect.top
- : (FX_FLOAT)devicePageRect.bottom();
- break;
- default:
- break;
- }
- return m;
-}
-
-bool PageWidgetFilter(CXFA_FFWidget* pWidget,
- uint32_t dwFilter,
- bool bTraversal,
- bool bIgnorerelevant) {
- CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
-
- if (!!(dwFilter & XFA_WidgetStatus_Focused) &&
- pWidgetAcc->GetElementType() != XFA_Element::Field) {
- return false;
- }
-
- uint32_t dwStatus = pWidget->GetStatus();
- if (bTraversal && (dwStatus & XFA_WidgetStatus_Disabled))
- return false;
- if (bIgnorerelevant)
- return !!(dwStatus & XFA_WidgetStatus_Visible);
-
- dwFilter &= (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable |
- XFA_WidgetStatus_Printable);
- return (dwFilter & dwStatus) == dwFilter;
-}
-
-bool IsLayoutElement(XFA_Element eElement, bool bLayoutContainer) {
- switch (eElement) {
- case XFA_Element::Draw:
- case XFA_Element::Field:
- case XFA_Element::InstanceManager:
- return !bLayoutContainer;
- case XFA_Element::Area:
- case XFA_Element::Subform:
- case XFA_Element::ExclGroup:
- case XFA_Element::SubformSet:
- case XFA_Element::PageArea:
- case XFA_Element::Form:
- return true;
- default:
- return false;
- }
-}
-
-} // namespace
-
-CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
- : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {}
-
-CXFA_FFPageView::~CXFA_FFPageView() {}
-
-CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
- return m_pDocView;
-}
-
-CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
- return CFX_RectF(0, 0, GetPageSize());
-}
-
-CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const CFX_Rect& rtDisp,
- int32_t iRotate) const {
- return GetPageMatrix(CFX_RectF(0, 0, GetPageSize()), rtDisp, iRotate, 0);
-}
-
-IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
- uint32_t dwTraverseWay,
- uint32_t dwWidgetFilter) {
- switch (dwTraverseWay) {
- case XFA_TRAVERSEWAY_Tranvalse:
- return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter);
- case XFA_TRAVERSEWAY_Form:
- return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter);
- }
- return nullptr;
-}
-
-CXFA_FFPageWidgetIterator::CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView,
- uint32_t dwFilter) {
- m_pPageView = pPageView;
- m_dwFilter = dwFilter;
- m_sIterator.Init(pPageView);
- m_bIgnorerelevant =
- m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() <
- XFA_VERSION_205;
-}
-CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() {}
-void CXFA_FFPageWidgetIterator::Reset() {
- m_sIterator.Reset();
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() {
- m_sIterator.Reset();
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToNext()) {
- if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
- return hWidget;
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() {
- m_sIterator.SetCurrent(nullptr);
- return MoveToPrevious();
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToNext()) {
- if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
- return hWidget;
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToPrev()) {
- if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
- return hWidget;
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() {
- CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent();
- return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : nullptr;
-}
-bool CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) {
- return hWidget && m_sIterator.SetCurrent(hWidget);
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget(
- CXFA_LayoutItem* pLayoutItem) {
- if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
- if (!PageWidgetFilter(pWidget, m_dwFilter, false, m_bIgnorerelevant)) {
- return nullptr;
- }
- if (!pWidget->IsLoaded() &&
- (pWidget->GetStatus() & XFA_WidgetStatus_Visible) != 0) {
- pWidget->LoadWidget();
- }
- return pWidget;
- }
- return nullptr;
-}
-
-CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator(
- CXFA_FFPageView* pPageView,
- uint32_t dwFilter)
- : m_pPageView(pPageView), m_dwFilter(dwFilter), m_iCurWidget(-1) {
- m_bIgnorerelevant =
- m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() <
- XFA_VERSION_205;
- Reset();
-}
-
-CXFA_FFTabOrderPageWidgetIterator::~CXFA_FFTabOrderPageWidgetIterator() {}
-
-void CXFA_FFTabOrderPageWidgetIterator::Reset() {
- CreateTabOrderWidgetArray();
- m_iCurWidget = -1;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
- for (int32_t i = 0;
- i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
- for (int32_t i = pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
- i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
- for (int32_t i = m_iCurWidget + 1;
- i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- m_iCurWidget = -1;
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() {
- for (int32_t i = m_iCurWidget - 1; i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- m_iCurWidget = -1;
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() {
- return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget] : nullptr;
-}
-
-bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget(
- CXFA_FFWidget* hWidget) {
- auto it = std::find(m_TabOrderWidgetArray.begin(),
- m_TabOrderWidgetArray.end(), hWidget);
- if (it == m_TabOrderWidgetArray.end())
- return false;
-
- m_iCurWidget = it - m_TabOrderWidgetArray.begin();
- return true;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget(
- CXFA_FFWidget* pWidget) {
- CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
- CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_Element::Traversal);
- if (pTraversal) {
- CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse);
- if (pTraverse) {
- CFX_WideString wsTraverseWidgetName;
- if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
- return FindWidgetByName(wsTraverseWidgetName, pWidget);
- }
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName(
- const CFX_WideString& wsWidgetName,
- CXFA_FFWidget* pRefWidget) {
- return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget);
-}
-
-void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
- m_TabOrderWidgetArray.clear();
-
- std::vector<CXFA_FFWidget*> SpaceOrderWidgetArray;
- CreateSpaceOrderWidgetArray(&SpaceOrderWidgetArray);
- if (SpaceOrderWidgetArray.empty())
- return;
-
- int32_t nWidgetCount = pdfium::CollectionSize<int32_t>(SpaceOrderWidgetArray);
- CXFA_FFWidget* hWidget = SpaceOrderWidgetArray[0];
- while (pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) <
- nWidgetCount) {
- if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
- m_TabOrderWidgetArray.push_back(hWidget);
- CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
- if (pWidgetAcc->GetUIType() == XFA_Element::ExclGroup) {
- auto it = std::find(SpaceOrderWidgetArray.begin(),
- SpaceOrderWidgetArray.end(), hWidget);
- int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end()
- ? it - SpaceOrderWidgetArray.begin() + 1
- : 0;
- while (true) {
- CXFA_FFWidget* pRadio =
- SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount];
- if (pRadio->GetDataAcc()->GetExclGroup() != pWidgetAcc) {
- break;
- }
- if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
- m_TabOrderWidgetArray.push_back(pRadio);
- }
- iWidgetIndex++;
- }
- }
- if (CXFA_FFWidget* hTraverseWidget = GetTraverseWidget(hWidget)) {
- hWidget = hTraverseWidget;
- continue;
- }
- }
- auto it = std::find(SpaceOrderWidgetArray.begin(),
- SpaceOrderWidgetArray.end(), hWidget);
- int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end()
- ? it - SpaceOrderWidgetArray.begin() + 1
- : 0;
- hWidget = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount];
- }
-}
-
-static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1,
- const void* phWidget2) {
- auto param1 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget1));
- auto param2 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget2));
- CFX_RectF rt1 = param1->m_pWidget->GetWidgetRect();
- CFX_RectF rt2 = param2->m_pWidget->GetWidgetRect();
- FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top;
- if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2))
- return -1;
- return 1;
-}
-
-void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
- CXFA_LayoutItemIterator* sIterator,
- CXFA_LayoutItem* pContainerItem,
- CXFA_TabParam* pContainer,
- bool& bCurrentItem,
- bool& bContentArea,
- bool bMarsterPage) {
- CFX_ArrayTemplate<CXFA_TabParam*> tabParams;
- CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext();
- while (pSearchItem) {
- if (!pSearchItem->IsContentLayoutItem()) {
- bContentArea = true;
- pSearchItem = sIterator->MoveToNext();
- continue;
- }
- if (bMarsterPage && bContentArea) {
- break;
- }
- if (bMarsterPage || bContentArea) {
- CXFA_FFWidget* hWidget = GetWidget(pSearchItem);
- if (!hWidget) {
- pSearchItem = sIterator->MoveToNext();
- continue;
- }
- if (pContainerItem && (pSearchItem->GetParent() != pContainerItem)) {
- bCurrentItem = true;
- break;
- }
- CXFA_TabParam* pParam = new CXFA_TabParam;
- pParam->m_pWidget = hWidget;
- tabParams.Add(pParam);
- if (IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), true)) {
- OrderContainer(sIterator, pSearchItem, pParam, bCurrentItem,
- bContentArea, bMarsterPage);
- }
- }
- if (bCurrentItem) {
- pSearchItem = sIterator->GetCurrent();
- bCurrentItem = false;
- } else {
- pSearchItem = sIterator->MoveToNext();
- }
- }
- int32_t iChildren = tabParams.GetSize();
- if (iChildren > 1) {
- FXSYS_qsort(tabParams.GetData(), iChildren, sizeof(void*),
- XFA_TabOrderWidgetComparator);
- }
- for (int32_t iStart = 0; iStart < iChildren; iStart++) {
- std::unique_ptr<CXFA_TabParam> pParam(tabParams[iStart]);
- pContainer->m_Children.push_back(pParam->m_pWidget);
- pContainer->m_Children.insert(pContainer->m_Children.end(),
- pParam->m_Children.begin(),
- pParam->m_Children.end());
- }
- tabParams.RemoveAll();
-}
-void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
- std::vector<CXFA_FFWidget*>* WidgetArray) {
- CXFA_LayoutItemIterator sIterator;
- sIterator.Init(m_pPageView);
- auto pParam = pdfium::MakeUnique<CXFA_TabParam>();
- bool bCurrentItem = false;
- bool bContentArea = false;
- OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea);
- WidgetArray->insert(WidgetArray->end(), pParam->m_Children.begin(),
- pParam->m_Children.end());
-
- sIterator.Reset();
- bCurrentItem = false;
- bContentArea = false;
- pParam->m_Children.clear();
- OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea,
- true);
- WidgetArray->insert(WidgetArray->end(), pParam->m_Children.begin(),
- pParam->m_Children.end());
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget(
- CXFA_LayoutItem* pLayoutItem) {
- if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
- if (!pWidget->IsLoaded() &&
- (pWidget->GetStatus() & XFA_WidgetStatus_Visible)) {
- pWidget->LoadWidget();
- }
- return pWidget;
- }
- return nullptr;
-}
-
-CXFA_TabParam::CXFA_TabParam() : m_pWidget(nullptr) {}
-
-CXFA_TabParam::~CXFA_TabParam() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp
index 43016fe5c63..854a028aaca 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp
@@ -7,10 +7,10 @@
#include "xfa/fxfa/app/xfa_ffpath.h"
#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
@@ -20,8 +20,8 @@ CXFA_FFLine::~CXFA_FFLine() {}
void CXFA_FFLine::GetRectFromHand(CFX_RectF& rect,
int32_t iHand,
- FX_FLOAT fLineWidth) {
- FX_FLOAT fHalfWidth = fLineWidth / 2.0f;
+ float fLineWidth) {
+ float fHalfWidth = fLineWidth / 2.0f;
if (rect.height < 1.0f) {
switch (iHand) {
case XFA_ATTRIBUTEENUM_Left:
@@ -64,7 +64,7 @@ void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS,
CXFA_Line lineObj = value.GetLine();
FX_ARGB lineColor = 0xFF000000;
int32_t iStrokeType = 0;
- FX_FLOAT fLineWidth = 1.0f;
+ float fLineWidth = 1.0f;
int32_t iCap = 0;
CXFA_Edge edge = lineObj.GetEdge();
if (edge) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h
index 002f75d262f..6df53f4e1d6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h
@@ -20,7 +20,7 @@ class CXFA_FFLine : public CXFA_FFDraw {
uint32_t dwStatus) override;
private:
- void GetRectFromHand(CFX_RectF& rect, int32_t iHand, FX_FLOAT fLineWidth);
+ void GetRectFromHand(CFX_RectF& rect, int32_t iHand, float fLineWidth);
};
class CXFA_FFArc : public CXFA_FFDraw {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 7b6be820356..fa5c0dc9a14 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -12,19 +12,14 @@
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
CXFA_FFPushButton::CXFA_FFPushButton(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFField(pDataAcc),
- m_pRolloverTextLayout(nullptr),
- m_pDownTextLayout(nullptr),
- m_pDownProvider(nullptr),
- m_pRollProvider(nullptr),
- m_pOldDelegate(nullptr) {}
+ : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
CXFA_FFPushButton::~CXFA_FFPushButton() {
CXFA_FFPushButton::UnloadWidget();
@@ -86,14 +81,10 @@ void CXFA_FFPushButton::UpdateWidgetProperty() {
}
void CXFA_FFPushButton::UnloadWidget() {
- delete m_pRolloverTextLayout;
- m_pRolloverTextLayout = nullptr;
- delete m_pDownTextLayout;
- m_pDownTextLayout = nullptr;
- delete m_pDownProvider;
- m_pDownProvider = nullptr;
- delete m_pRollProvider;
- m_pRollProvider = nullptr;
+ m_pRolloverTextLayout.reset();
+ m_pDownTextLayout.reset();
+ m_pRollProvider.reset();
+ m_pDownProvider.reset();
CXFA_FFField::UnloadWidget();
}
@@ -117,7 +108,7 @@ bool CXFA_FFPushButton::PerformLayout() {
return true;
}
-FX_FLOAT CXFA_FFPushButton::GetLineWidth() {
+float CXFA_FFPushButton::GetLineWidth() {
CXFA_Border border = m_pDataAcc->GetBorder();
if (border && border.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
CXFA_Edge edge = border.GetEdge(0);
@@ -125,36 +116,41 @@ FX_FLOAT CXFA_FFPushButton::GetLineWidth() {
}
return 0;
}
+
FX_ARGB CXFA_FFPushButton::GetLineColor() {
return 0xFF000000;
}
+
FX_ARGB CXFA_FFPushButton::GetFillColor() {
return 0xFFFFFFFF;
}
+
void CXFA_FFPushButton::LoadHighlightCaption() {
CXFA_Caption caption = m_pDataAcc->GetCaption();
- if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
- {
- CFX_WideString wsRollover;
- bool bRichText;
- if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) {
- if (!m_pRollProvider) {
- m_pRollProvider =
- new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover);
- }
- m_pRolloverTextLayout = new CXFA_TextLayout(m_pRollProvider);
- }
- CFX_WideString wsDown;
- if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) {
- if (!m_pDownProvider) {
- m_pDownProvider =
- new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down);
- }
- m_pDownTextLayout = new CXFA_TextLayout(m_pDownProvider);
- }
+ if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden)
+ return;
+
+ bool bRichText;
+ CFX_WideString wsRollover;
+ if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) {
+ if (!m_pRollProvider) {
+ m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>(
+ m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover);
+ }
+ m_pRolloverTextLayout =
+ pdfium::MakeUnique<CXFA_TextLayout>(m_pRollProvider.get());
+ }
+ CFX_WideString wsDown;
+ if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) {
+ if (!m_pDownProvider) {
+ m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>(
+ m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down);
}
+ m_pDownTextLayout =
+ pdfium::MakeUnique<CXFA_TextLayout>(m_pDownProvider.get());
}
}
+
void CXFA_FFPushButton::LayoutHighlightCaption() {
CFX_SizeF sz(m_rtCaption.width, m_rtCaption.height);
LayoutCaption();
@@ -210,7 +206,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics,
if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
(m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
CFX_RectF rtFill(0, 0, m_pNormalWidget->GetWidgetRect().Size());
- FX_FLOAT fLineWith = GetLineWidth();
+ float fLineWith = GetLineWidth();
rtFill.Deflate(fLineWith, fLineWith);
CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255));
pGraphics->SetFillColor(&cr);
@@ -223,7 +219,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics,
XFA_FWL_PSBSTYLEEXT_HiliteOutLine) {
if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
(m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
- FX_FLOAT fLineWidth = GetLineWidth();
+ float fLineWidth = GetLineWidth();
CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255));
pGraphics->SetStrokeColor(&cr);
pGraphics->SetLineWidth(fLineWidth);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h
index eb18ccb11ca..d2f5746fe92 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
#define XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
+#include <memory>
+
#include "xfa/fxfa/app/xfa_fffield.h"
#define XFA_FWL_PSBSTYLEEXT_HiliteNone (0L << 0)
@@ -34,18 +36,18 @@ class CXFA_FFPushButton : public CXFA_FFField {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
- protected:
+ private:
void LoadHighlightCaption();
void LayoutHighlightCaption();
void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr);
- FX_FLOAT GetLineWidth();
+ float GetLineWidth();
FX_ARGB GetLineColor();
FX_ARGB GetFillColor();
- CXFA_TextLayout* m_pRolloverTextLayout;
- CXFA_TextLayout* m_pDownTextLayout;
- CXFA_TextProvider* m_pDownProvider;
- CXFA_TextProvider* m_pRollProvider;
+ std::unique_ptr<CXFA_TextLayout> m_pRolloverTextLayout;
+ std::unique_ptr<CXFA_TextLayout> m_pDownTextLayout;
+ std::unique_ptr<CXFA_TextProvider> m_pRollProvider;
+ std::unique_ptr<CXFA_TextProvider> m_pDownProvider;
IFWL_WidgetDelegate* m_pOldDelegate;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp
index bf2bba3adff..edc34336c69 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp
@@ -7,9 +7,9 @@
#include "xfa/fxfa/app/xfa_ffsignature.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFSignature::CXFA_FFSignature(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp
index 0b479f4d4cd..d008c5b4f91 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp
@@ -6,10 +6,10 @@
#include "xfa/fxfa/app/xfa_ffsubform.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFSubForm::CXFA_FFSubForm(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFWidget(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h
index e6b77a8b33e..c87688fdcef 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h
@@ -7,8 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFSUBFORM_H_
#define XFA_FXFA_APP_XFA_FFSUBFORM_H_
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
class CXFA_FFSubForm : public CXFA_FFWidget {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp
index e8d7aa32d02..6885bfc93f6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp
@@ -13,10 +13,10 @@
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_ffdraw.h"
#include "xfa/fxfa/app/xfa_textpiece.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_graphics.h"
CXFA_FFText::CXFA_FFText(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
@@ -46,10 +46,10 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
if (!pItem->GetPrev() && !pItem->GetNext()) {
XFA_RectWidthoutMargin(rtText, mgWidget);
} else {
- FX_FLOAT fLeftInset;
- FX_FLOAT fRightInset;
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fBottomInset = 0;
+ float fLeftInset;
+ float fRightInset;
+ float fTopInset = 0;
+ float fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
if (!pItem->GetPrev())
@@ -75,13 +75,13 @@ bool CXFA_FFText::IsLoaded() {
bool CXFA_FFText::PerformLayout() {
CXFA_FFDraw::PerformLayout();
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
- if (!pTextLayout) {
+ if (!pTextLayout)
return false;
- }
- if (!pTextLayout->m_bHasBlock) {
+
+ if (!pTextLayout->m_bHasBlock)
return true;
- }
- pTextLayout->m_Blocks.RemoveAll();
+
+ pTextLayout->m_Blocks.clear();
CXFA_LayoutItem* pItem = this;
if (!pItem->GetPrev() && !pItem->GetNext()) {
return true;
@@ -91,11 +91,11 @@ bool CXFA_FFText::PerformLayout() {
CFX_RectF rtText = pItem->GetRect(false);
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
if (!pItem->GetPrev()) {
- FX_FLOAT fTopInset;
+ float fTopInset;
mgWidget.GetTopInset(fTopInset);
rtText.height -= fTopInset;
} else if (!pItem->GetNext()) {
- FX_FLOAT fBottomInset;
+ float fBottomInset;
mgWidget.GetBottomInset(fBottomInset);
rtText.height -= fBottomInset;
}
@@ -111,7 +111,7 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
if (!GetRectWithoutRotate().Contains(point))
return false;
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
+ const wchar_t* wsURLContent = GetLinkURLAtPoint(point);
if (!wsURLContent)
return false;
@@ -128,7 +128,7 @@ bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
return false;
SetButtonDown(false);
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
+ const wchar_t* wsURLContent = GetLinkURLAtPoint(point);
if (!wsURLContent)
return false;
@@ -145,7 +145,7 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) {
return FWL_WidgetHit::HyperLink;
}
-const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
+const wchar_t* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return nullptr;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h
index c5538217914..eddc1224aca 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h
@@ -26,7 +26,7 @@ class CXFA_FFText : public CXFA_FFDraw {
bool PerformLayout() override;
private:
- const FX_WCHAR* GetLinkURLAtPoint(const CFX_PointF& point);
+ const wchar_t* GetLinkURLAtPoint(const CFX_PointF& point);
};
#endif // XFA_FXFA_APP_XFA_FFTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp
index 094839f4862..2658758718d 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -21,12 +21,13 @@
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -521,10 +522,9 @@ bool CXFA_FFDateTimeEdit::LoadWidget() {
case XFA_Element::Date: {
if (!wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
- CFX_Unitime date = lcValue.GetDate();
- if ((FX_UNITIME)date != 0) {
+ CFX_DateTime date = lcValue.GetDate();
+ if (date.IsSet())
pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
- }
}
} break;
default:
@@ -618,10 +618,10 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() {
((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText);
if (IsFocused() && !wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
- CFX_Unitime date = lcValue.GetDate();
+ CFX_DateTime date = lcValue.GetDate();
if (lcValue.IsValid()) {
- if ((FX_UNITIME)date != 0) {
- ((CFWL_DateTimePicker*)m_pNormalWidget)
+ if (date.IsSet()) {
+ static_cast<CFWL_DateTimePicker*>(m_pNormalWidget)
->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
}
}
@@ -647,9 +647,8 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
CFX_WideString wsPicture;
m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
- CFX_Unitime dt;
- dt.Set(iYear, iMonth, iDay);
- date.SetDate(dt);
+ date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
+
CFX_WideString wsDate;
date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
XFA_VALUEPICTURE_Edit);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h
index 1e0562a75b3..9b9324f9d21 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h
@@ -36,14 +36,15 @@ class CXFA_FFTextEdit : public CXFA_FFField {
bool CheckWord(const CFX_ByteStringC& sWord);
protected:
+ uint32_t GetAlignment();
+
+ IFWL_WidgetDelegate* m_pOldDelegate;
+
+ private:
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
-
- uint32_t GetAlignment();
void ValidateNumberField(const CFX_WideString& wsText);
-
- IFWL_WidgetDelegate* m_pOldDelegate;
};
class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
@@ -56,7 +57,7 @@ class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
void UpdateWidgetProperty() override;
void OnProcessEvent(CFWL_Event* pEvent) override;
- public:
+ private:
bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText);
};
@@ -68,8 +69,6 @@ class CXFA_FFPasswordEdit : public CXFA_FFTextEdit {
// CXFA_FFTextEdit
bool LoadWidget() override;
void UpdateWidgetProperty() override;
-
- protected:
};
enum XFA_DATETIMETYPE {
@@ -94,7 +93,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
int32_t iMonth,
int32_t iDay);
- protected:
+ private:
bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
bool UpdateFWLData() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp
deleted file mode 100644
index 9995fd11b2a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp
+++ /dev/null
@@ -1,2050 +0,0 @@
-// 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/fxfa/xfa_ffwidget.h"
-
-#include <algorithm>
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/page/cpdf_pageobjectholder.h"
-#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
-#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/cfx_maybe_owned.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "xfa/fwl/fwl_widgethit.h"
-#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/fxfa_widget.h"
-#include "xfa/fxfa/parser/cxfa_corner.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxgraphics/cfx_color.h"
-#include "xfa/fxgraphics/cfx_graphics.h"
-#include "xfa/fxgraphics/cfx_path.h"
-#include "xfa/fxgraphics/cfx_pattern.h"
-#include "xfa/fxgraphics/cfx_shading.h"
-
-CXFA_FFWidget::CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc)
- : CXFA_ContentLayoutItem(pDataAcc->GetNode()),
- m_pPageView(nullptr),
- m_pDataAcc(pDataAcc) {}
-
-CXFA_FFWidget::~CXFA_FFWidget() {}
-
-const CFWL_App* CXFA_FFWidget::GetFWLApp() {
- return GetPageView()->GetDocView()->GetDoc()->GetApp()->GetFWLApp();
-}
-
-CFX_RectF CXFA_FFWidget::GetWidgetRect() {
- if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0)
- RecacheWidgetRect();
- return m_rtWidget;
-}
-
-CFX_RectF CXFA_FFWidget::RecacheWidgetRect() {
- m_dwStatus |= XFA_WidgetStatus_RectCached;
- m_rtWidget = GetRect(false);
- return m_rtWidget;
-}
-
-CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
- CFX_RectF rtWidget = GetWidgetRect();
- FX_FLOAT fValue = 0;
- switch (m_pDataAcc->GetRotate()) {
- case 90:
- rtWidget.top = rtWidget.bottom();
- fValue = rtWidget.width;
- rtWidget.width = rtWidget.height;
- rtWidget.height = fValue;
- break;
- case 180:
- rtWidget.left = rtWidget.right();
- rtWidget.top = rtWidget.bottom();
- break;
- case 270:
- rtWidget.left = rtWidget.right();
- fValue = rtWidget.width;
- rtWidget.width = rtWidget.height;
- rtWidget.height = fValue;
- break;
- }
- return rtWidget;
-}
-
-uint32_t CXFA_FFWidget::GetStatus() {
- return m_dwStatus;
-}
-
-void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) {
- m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded;
-}
-
-CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- if (bDrawFocus || !m_pPageView)
- return CFX_RectF();
- return m_pPageView->GetPageViewRect();
-}
-
-CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
- return m_pDataAcc;
-}
-
-bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
- if (CXFA_Assist assist = m_pDataAcc->GetAssist()) {
- if (CXFA_ToolTip toolTip = assist.GetToolTip()) {
- return toolTip.GetTip(wsToolTip);
- }
- }
- return GetCaptionText(wsToolTip);
-}
-
-void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus))
- return;
-
- CXFA_Border border = m_pDataAcc->GetBorder();
- if (!border)
- return;
-
- CFX_RectF rtBorder = GetRectWithoutRotate();
- CXFA_Margin margin = border.GetMargin();
- if (margin)
- XFA_RectWidthoutMargin(rtBorder, margin);
-
- rtBorder.Normalize();
- DrawBorder(pGS, border, rtBorder, pMatrix);
-}
-
-bool CXFA_FFWidget::IsLoaded() {
- return !!m_pPageView;
-}
-bool CXFA_FFWidget::LoadWidget() {
- PerformLayout();
- return true;
-}
-void CXFA_FFWidget::UnloadWidget() {}
-bool CXFA_FFWidget::PerformLayout() {
- RecacheWidgetRect();
- return true;
-}
-bool CXFA_FFWidget::UpdateFWLData() {
- return false;
-}
-void CXFA_FFWidget::UpdateWidgetProperty() {}
-void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS,
- CXFA_Box box,
- const CFX_RectF& rtBorder,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags);
-}
-
-void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) {
- if (pRect) {
- GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, *pRect,
- XFA_INVALIDATE_CurrentPage);
- return;
- }
-
- CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused);
- rtWidget.Inflate(2, 2);
- GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget,
- XFA_INVALIDATE_CurrentPage);
-}
-
-void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) {
- CFX_RectF rtWidget;
- if (pRect) {
- rtWidget = *pRect;
- } else {
- rtWidget = GetBBox(XFA_WidgetStatus_Focused);
- rtWidget.Inflate(2, 2);
- }
- m_pDocView->AddInvalidateRect(m_pPageView, rtWidget);
-}
-
-bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) {
- CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout();
- if (!pCapTextlayout) {
- return false;
- }
- pCapTextlayout->GetText(wsCap);
- return true;
-}
-
-bool CXFA_FFWidget::IsFocused() {
- return !!(m_dwStatus & XFA_WidgetStatus_Focused);
-}
-
-bool CXFA_FFWidget::OnMouseEnter() {
- return false;
-}
-
-bool CXFA_FFWidget::OnMouseExit() {
- return false;
-}
-
-bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags,
- int16_t zDelta,
- const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) {
- CXFA_FFWidget* pParent = GetParent();
- if (pParent && !pParent->IsAncestorOf(pOldWidget)) {
- pParent->OnSetFocus(pOldWidget);
- }
- m_dwStatus |= XFA_WidgetStatus_Focused;
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Enter;
- eParam.m_pTarget = m_pDataAcc;
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam);
- return true;
-}
-
-bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) {
- m_dwStatus &= ~XFA_WidgetStatus_Focused;
- EventKillFocus();
- if (pNewWidget) {
- CXFA_FFWidget* pParent = GetParent();
- if (pParent && !pParent->IsAncestorOf(pNewWidget)) {
- pParent->OnKillFocus(pNewWidget);
- }
- }
- return true;
-}
-
-bool CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
- return false;
-}
-
-bool CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
- return false;
-}
-
-bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) {
- return false;
-}
-
-FWL_WidgetHit CXFA_FFWidget::OnHitTest(const CFX_PointF& point) {
- return FWL_WidgetHit::Unknown;
-}
-
-bool CXFA_FFWidget::OnSetCursor(const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::CanUndo() {
- return false;
-}
-
-bool CXFA_FFWidget::CanRedo() {
- return false;
-}
-
-bool CXFA_FFWidget::Undo() {
- return false;
-}
-
-bool CXFA_FFWidget::Redo() {
- return false;
-}
-
-bool CXFA_FFWidget::CanCopy() {
- return false;
-}
-
-bool CXFA_FFWidget::CanCut() {
- return false;
-}
-
-bool CXFA_FFWidget::CanPaste() {
- return false;
-}
-
-bool CXFA_FFWidget::CanSelectAll() {
- return false;
-}
-
-bool CXFA_FFWidget::CanDelete() {
- return CanCut();
-}
-
-bool CXFA_FFWidget::CanDeSelect() {
- return CanCopy();
-}
-
-bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) {
- return false;
-}
-
-bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) {
- return false;
-}
-
-bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) {
- return false;
-}
-
-void CXFA_FFWidget::SelectAll() {}
-
-void CXFA_FFWidget::Delete() {}
-
-void CXFA_FFWidget::DeSelect() {}
-
-bool CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest) {
- return false;
-}
-bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace) {
- return false;
-}
-
-CFX_PointF CXFA_FFWidget::Rotate2Normal(const CFX_PointF& point) {
- CFX_Matrix mt = GetRotateMatrix();
- if (mt.IsIdentity())
- return point;
-
- CFX_Matrix mtReverse;
- mtReverse.SetReverse(mt);
- return mtReverse.Transform(point);
-}
-
-static void XFA_GetMatrix(CFX_Matrix& m,
- int32_t iRotate,
- XFA_ATTRIBUTEENUM at,
- const CFX_RectF& rt) {
- if (!iRotate) {
- return;
- }
- FX_FLOAT fAnchorX = 0;
- FX_FLOAT fAnchorY = 0;
- switch (at) {
- case XFA_ATTRIBUTEENUM_TopLeft:
- fAnchorX = rt.left, fAnchorY = rt.top;
- break;
- case XFA_ATTRIBUTEENUM_TopCenter:
- fAnchorX = (rt.left + rt.right()) / 2, fAnchorY = rt.top;
- break;
- case XFA_ATTRIBUTEENUM_TopRight:
- fAnchorX = rt.right(), fAnchorY = rt.top;
- break;
- case XFA_ATTRIBUTEENUM_MiddleLeft:
- fAnchorX = rt.left, fAnchorY = (rt.top + rt.bottom()) / 2;
- break;
- case XFA_ATTRIBUTEENUM_MiddleCenter:
- fAnchorX = (rt.left + rt.right()) / 2,
- fAnchorY = (rt.top + rt.bottom()) / 2;
- break;
- case XFA_ATTRIBUTEENUM_MiddleRight:
- fAnchorX = rt.right(), fAnchorY = (rt.top + rt.bottom()) / 2;
- break;
- case XFA_ATTRIBUTEENUM_BottomLeft:
- fAnchorX = rt.left, fAnchorY = rt.bottom();
- break;
- case XFA_ATTRIBUTEENUM_BottomCenter:
- fAnchorX = (rt.left + rt.right()) / 2, fAnchorY = rt.bottom();
- break;
- case XFA_ATTRIBUTEENUM_BottomRight:
- fAnchorX = rt.right(), fAnchorY = rt.bottom();
- break;
- default:
- break;
- }
- switch (iRotate) {
- case 90:
- m.a = 0, m.b = -1, m.c = 1, m.d = 0, m.e = fAnchorX - fAnchorY,
- m.f = fAnchorX + fAnchorY;
- break;
- case 180:
- m.a = -1, m.b = 0, m.c = 0, m.d = -1, m.e = fAnchorX * 2,
- m.f = fAnchorY * 2;
- break;
- case 270:
- m.a = 0, m.b = 1, m.c = -1, m.d = 0, m.e = fAnchorX + fAnchorY,
- m.f = fAnchorY - fAnchorX;
- break;
- }
-}
-
-CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
- CFX_Matrix mt;
- int32_t iRotate = m_pDataAcc->GetRotate();
- if (!iRotate)
- return mt;
-
- CFX_RectF rcWidget = GetRectWithoutRotate();
- XFA_ATTRIBUTEENUM at = XFA_ATTRIBUTEENUM_TopLeft;
- XFA_GetMatrix(mt, iRotate, at, rcWidget);
-
- return mt;
-}
-
-bool CXFA_FFWidget::IsLayoutRectEmpty() {
- CFX_RectF rtLayout = GetRectWithoutRotate();
- return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
-}
-CXFA_FFWidget* CXFA_FFWidget::GetParent() {
- CXFA_Node* pParentNode =
- m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent);
- if (pParentNode) {
- CXFA_WidgetAcc* pParentWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetData());
- if (pParentWidgetAcc) {
- return pParentWidgetAcc->GetNextWidget(nullptr);
- }
- }
- return nullptr;
-}
-
-bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
- if (!pWidget)
- return false;
-
- CXFA_Node* pNode = m_pDataAcc->GetNode();
- CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
- while (pChildNode) {
- if (pChildNode == pNode)
- return true;
-
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent);
- }
- return false;
-}
-
-bool CXFA_FFWidget::PtInActiveRect(const CFX_PointF& point) {
- return GetWidgetRect().Contains(point);
-}
-
-CXFA_FFDocView* CXFA_FFWidget::GetDocView() {
- return m_pDocView;
-}
-
-void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) {
- m_pDocView = pDocView;
-}
-
-CXFA_FFDoc* CXFA_FFWidget::GetDoc() {
- return m_pDocView->GetDoc();
-}
-
-CXFA_FFApp* CXFA_FFWidget::GetApp() {
- return GetDoc()->GetApp();
-}
-
-IXFA_AppProvider* CXFA_FFWidget::GetAppProvider() {
- return GetApp()->GetAppProvider();
-}
-
-bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) {
- return !!(m_dwStatus & XFA_WidgetStatus_Visible);
-}
-
-void CXFA_FFWidget::EventKillFocus() {
- if (m_dwStatus & XFA_WidgetStatus_Access) {
- m_dwStatus &= ~XFA_WidgetStatus_Access;
- return;
- }
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Exit;
- eParam.m_pTarget = m_pDataAcc;
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam);
-}
-bool CXFA_FFWidget::IsButtonDown() {
- return (m_dwStatus & XFA_WidgetStatus_ButtonDown) != 0;
-}
-void CXFA_FFWidget::SetButtonDown(bool bSet) {
- bSet ? m_dwStatus |= XFA_WidgetStatus_ButtonDown
- : m_dwStatus &= ~XFA_WidgetStatus_ButtonDown;
-}
-int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics,
- int32_t iStrokeType,
- int32_t iCapType) {
- switch (iStrokeType) {
- case XFA_ATTRIBUTEENUM_DashDot: {
- FX_FLOAT dashArray[] = {4, 1, 2, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- dashArray[3] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 4);
- return FX_DASHSTYLE_DashDot;
- }
- case XFA_ATTRIBUTEENUM_DashDotDot: {
- FX_FLOAT dashArray[] = {4, 1, 2, 1, 2, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- dashArray[3] = 2;
- dashArray[5] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 6);
- return FX_DASHSTYLE_DashDotDot;
- }
- case XFA_ATTRIBUTEENUM_Dashed: {
- FX_FLOAT dashArray[] = {5, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 2);
- return FX_DASHSTYLE_Dash;
- }
- case XFA_ATTRIBUTEENUM_Dotted: {
- FX_FLOAT dashArray[] = {2, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 2);
- return FX_DASHSTYLE_Dot;
- }
- default:
- break;
- }
- pGraphics->SetLineDash(FX_DASHSTYLE_Solid);
- return FX_DASHSTYLE_Solid;
-}
-CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap) {
- switch (iLineCap) {
- case XFA_ATTRIBUTEENUM_Round:
- return CFX_GraphStateData::LineCapRound;
- case XFA_ATTRIBUTEENUM_Butt:
- return CFX_GraphStateData::LineCapButt;
- default:
- break;
- }
- return CFX_GraphStateData::LineCapSquare;
-}
-
-class CXFA_ImageRenderer {
- public:
- CXFA_ImageRenderer();
- ~CXFA_ImageRenderer();
-
- bool Start(CFX_RenderDevice* pDevice,
- CFX_DIBSource* pDIBSource,
- FX_ARGB bitmap_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- uint32_t flags,
- int blendType = FXDIB_BLEND_NORMAL);
- bool Continue(IFX_Pause* pPause);
-
- protected:
- bool StartDIBSource();
- void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
- int left,
- int top,
- FX_ARGB mask_argb,
- int bitmap_alpha,
- int blend_mode,
- int Transparency);
-
- CFX_RenderDevice* m_pDevice;
- int m_Status;
- CFX_Matrix m_ImageMatrix;
- CFX_DIBSource* m_pDIBSource;
- std::unique_ptr<CFX_DIBitmap> m_pCloneConvert;
- int m_BitmapAlpha;
- FX_ARGB m_FillArgb;
- uint32_t m_Flags;
- std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
- void* m_DeviceHandle;
- int32_t m_BlendType;
- bool m_Result;
- bool m_bPrint;
-};
-
-CXFA_ImageRenderer::CXFA_ImageRenderer()
- : m_pDevice(nullptr),
- m_Status(0),
- m_pDIBSource(nullptr),
- m_BitmapAlpha(255),
- m_FillArgb(0),
- m_Flags(0),
- m_DeviceHandle(nullptr),
- m_BlendType(FXDIB_BLEND_NORMAL),
- m_Result(true),
- m_bPrint(false) {}
-
-CXFA_ImageRenderer::~CXFA_ImageRenderer() {
- if (m_DeviceHandle)
- m_pDevice->CancelDIBits(m_DeviceHandle);
-}
-
-bool CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
- CFX_DIBSource* pDIBSource,
- FX_ARGB bitmap_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- uint32_t flags,
- int blendType) {
- m_pDevice = pDevice;
- m_pDIBSource = pDIBSource;
- m_FillArgb = bitmap_argb;
- m_BitmapAlpha = bitmap_alpha;
- m_ImageMatrix = *pImage2Device;
- m_Flags = flags;
- m_BlendType = blendType;
- return StartDIBSource();
-}
-
-bool CXFA_ImageRenderer::StartDIBSource() {
- if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, m_BitmapAlpha, m_FillArgb,
- &m_ImageMatrix, m_Flags, m_DeviceHandle,
- m_BlendType)) {
- if (m_DeviceHandle) {
- m_Status = 3;
- return true;
- }
- return false;
- }
- CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
- FX_RECT image_rect = image_rect_f.GetOuterRect();
- int dest_width = image_rect.Width();
- int dest_height = image_rect.Height();
- if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
- (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
- if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = false;
- return false;
- }
- CFX_DIBSource* pDib = m_pDIBSource;
- if (m_pDIBSource->HasAlpha() &&
- !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) &&
- !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
- m_pCloneConvert = m_pDIBSource->CloneConvert(FXDIB_Rgb);
- if (!m_pCloneConvert) {
- m_Result = false;
- return false;
- }
- pDib = m_pCloneConvert.get();
- }
- FX_RECT clip_box = m_pDevice->GetClipBox();
- clip_box.Intersect(image_rect);
- m_Status = 2;
- m_pTransformer.reset(
- new CFX_ImageTransformer(pDib, &m_ImageMatrix, m_Flags, &clip_box));
- m_pTransformer->Start();
- return true;
- }
- if (m_ImageMatrix.a < 0) {
- dest_width = -dest_width;
- }
- if (m_ImageMatrix.d > 0) {
- dest_height = -dest_height;
- }
- int dest_left, dest_top;
- dest_left = dest_width > 0 ? image_rect.left : image_rect.right;
- dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom;
- if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) {
- if (m_pDevice->StretchDIBitsWithFlagsAndBlend(
- m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags,
- m_BlendType)) {
- return false;
- }
- }
- if (m_pDIBSource->IsAlphaMask()) {
- if (m_BitmapAlpha != 255) {
- m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
- }
- if (m_pDevice->StretchBitMaskWithFlags(m_pDIBSource, dest_left, dest_top,
- dest_width, dest_height, m_FillArgb,
- m_Flags)) {
- return false;
- }
- }
- if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = false;
- return true;
- }
- FX_RECT clip_box = m_pDevice->GetClipBox();
- FX_RECT dest_rect = clip_box;
- dest_rect.Intersect(image_rect);
- FX_RECT dest_clip(
- dest_rect.left - image_rect.left, dest_rect.top - image_rect.top,
- dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top);
- std::unique_ptr<CFX_DIBitmap> pStretched(
- m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip));
- if (pStretched) {
- CompositeDIBitmap(pStretched.get(), dest_rect.left, dest_rect.top,
- m_FillArgb, m_BitmapAlpha, m_BlendType, false);
- }
- return false;
-}
-
-bool CXFA_ImageRenderer::Continue(IFX_Pause* pPause) {
- if (m_Status == 2) {
- if (m_pTransformer->Continue(pPause))
- return true;
-
- std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap());
- if (!pBitmap)
- return false;
-
- if (pBitmap->IsAlphaMask()) {
- if (m_BitmapAlpha != 255)
- m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
- m_Result =
- m_pDevice->SetBitMask(pBitmap.get(), m_pTransformer->result().left,
- m_pTransformer->result().top, m_FillArgb);
- } else {
- if (m_BitmapAlpha != 255)
- pBitmap->MultiplyAlpha(m_BitmapAlpha);
- m_Result = m_pDevice->SetDIBitsWithBlend(
- pBitmap.get(), m_pTransformer->result().left,
- m_pTransformer->result().top, m_BlendType);
- }
- return false;
- }
- if (m_Status == 3)
- return m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
-
- return false;
-}
-
-void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
- int left,
- int top,
- FX_ARGB mask_argb,
- int bitmap_alpha,
- int blend_mode,
- int Transparency) {
- if (!pDIBitmap) {
- return;
- }
- bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED);
- bool bGroup = !!(Transparency & PDFTRANS_GROUP);
- if (blend_mode == FXDIB_BLEND_NORMAL) {
- if (!pDIBitmap->IsAlphaMask()) {
- if (bitmap_alpha < 255) {
- pDIBitmap->MultiplyAlpha(bitmap_alpha);
- }
- if (m_pDevice->SetDIBits(pDIBitmap, left, top)) {
- return;
- }
- } else {
- uint32_t fill_argb = (mask_argb);
- if (bitmap_alpha < 255) {
- ((uint8_t*)&fill_argb)[3] =
- ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255;
- }
- if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) {
- return;
- }
- }
- }
- bool bBackAlphaRequired = blend_mode && bIsolated;
- bool bGetBackGround =
- ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
- (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) &&
- (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired);
- if (bGetBackGround) {
- if (bIsolated || !bGroup) {
- if (pDIBitmap->IsAlphaMask()) {
- return;
- }
- m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode);
- } else {
- FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
- top + pDIBitmap->GetHeight());
- rect.Intersect(m_pDevice->GetClipBox());
- CFX_MaybeOwned<CFX_DIBitmap> pClone;
- if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
- pClone = m_pDevice->GetBackDrop()->Clone(&rect);
- CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
- pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
- pForeBitmap, rect.left, rect.top);
- left = left >= 0 ? 0 : left;
- top = top >= 0 ? 0 : top;
- if (!pDIBitmap->IsAlphaMask())
- pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
- pDIBitmap, left, top, blend_mode);
- else
- pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(),
- pDIBitmap, mask_argb, left, top, blend_mode);
- } else {
- pClone = pDIBitmap;
- }
- if (m_pDevice->GetBackDrop()) {
- m_pDevice->SetDIBits(pClone.Get(), rect.left, rect.top);
- } else {
- if (pDIBitmap->IsAlphaMask())
- return;
- m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top,
- blend_mode);
- }
- }
- return;
- }
- if (!pDIBitmap->HasAlpha() ||
- (m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) {
- return;
- }
- std::unique_ptr<CFX_DIBitmap> pCloneConvert =
- pDIBitmap->CloneConvert(FXDIB_Rgb);
- if (!pCloneConvert)
- return;
-
- CXFA_ImageRenderer imageRender;
- if (!imageRender.Start(m_pDevice, pCloneConvert.get(), m_FillArgb,
- m_BitmapAlpha, &m_ImageMatrix, m_Flags)) {
- return;
- }
- while (imageRender.Continue(nullptr))
- continue;
-}
-
-void XFA_DrawImage(CFX_Graphics* pGS,
- const CFX_RectF& rtImage,
- CFX_Matrix* pMatrix,
- CFX_DIBitmap* pDIBitmap,
- int32_t iAspect,
- int32_t iImageXDpi,
- int32_t iImageYDpi,
- int32_t iHorzAlign,
- int32_t iVertAlign) {
- if (rtImage.IsEmpty())
- return;
- if (!pDIBitmap || !pDIBitmap->GetBuffer())
- return;
-
- CFX_RectF rtFit(
- rtImage.TopLeft(),
- XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
- XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
- switch (iAspect) {
- case XFA_ATTRIBUTEENUM_Fit: {
- FX_FLOAT f1 = rtImage.height / rtFit.height;
- FX_FLOAT f2 = rtImage.width / rtFit.width;
- f1 = std::min(f1, f2);
- rtFit.height = rtFit.height * f1;
- rtFit.width = rtFit.width * f1;
- } break;
- case XFA_ATTRIBUTEENUM_Actual:
- break;
- case XFA_ATTRIBUTEENUM_Height: {
- FX_FLOAT f1 = rtImage.height / rtFit.height;
- rtFit.height = rtImage.height;
- rtFit.width = f1 * rtFit.width;
- } break;
- case XFA_ATTRIBUTEENUM_None:
- rtFit.height = rtImage.height;
- rtFit.width = rtImage.width;
- break;
- case XFA_ATTRIBUTEENUM_Width: {
- FX_FLOAT f1 = rtImage.width / rtFit.width;
- rtFit.width = rtImage.width;
- rtFit.height = rtFit.height * f1;
- } break;
- }
- if (iHorzAlign == XFA_ATTRIBUTEENUM_Center) {
- rtFit.left += (rtImage.width - rtFit.width) / 2;
- } else if (iHorzAlign == XFA_ATTRIBUTEENUM_Right) {
- rtFit.left = rtImage.right() - rtFit.width;
- }
- if (iVertAlign == XFA_ATTRIBUTEENUM_Middle) {
- rtFit.top += (rtImage.height - rtFit.height) / 2;
- } else if (iVertAlign == XFA_ATTRIBUTEENUM_Bottom) {
- rtFit.top = rtImage.bottom() - rtImage.height;
- }
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- pRenderDevice->SaveState();
-
- CFX_PathData path;
- path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top);
- pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING);
-
- CFX_Matrix mtImage(1, 0, 0, -1, 0, 1);
- mtImage.Concat(
- CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top));
- mtImage.Concat(*pMatrix);
-
- CXFA_ImageRenderer imageRender;
- bool bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
- FXDIB_INTERPOL);
- while (bRet)
- bRet = imageRender.Continue(nullptr);
-
- pRenderDevice->RestoreState(false);
-}
-
-static const uint8_t g_inv_base64[128] = {
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
- 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
- 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 255, 255, 255, 255, 255,
-};
-
-static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) {
- uint8_t* pCP;
- int32_t i = 0, j = 0;
- if (iLen == 0) {
- iLen = FXSYS_strlen((FX_CHAR*)pStr);
- }
- pCP = FX_Alloc(uint8_t, iLen + 1);
- for (; i < iLen; i++) {
- if ((pStr[i] & 128) == 0) {
- if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') {
- pCP[j++] = pStr[i];
- }
- }
- }
- pCP[j] = '\0';
- return pCP;
-}
-static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) {
- if (!pStr) {
- return 0;
- }
- uint8_t* pBuffer =
- XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr));
- if (!pBuffer) {
- return 0;
- }
- int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer);
- int32_t i = 0, j = 0;
- uint32_t dwLimb = 0;
- for (; i + 3 < iLen; i += 4) {
- if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' ||
- pBuffer[i + 3] == '=') {
- if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') {
- break;
- }
- if (pBuffer[i + 2] == '=') {
- dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 6) |
- ((uint32_t)g_inv_base64[pBuffer[i + 1]]);
- pOutBuffer[j] = (uint8_t)(dwLimb >> 4) & 0xFF;
- j++;
- } else {
- dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 12) |
- ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 6) |
- ((uint32_t)g_inv_base64[pBuffer[i + 2]]);
- pOutBuffer[j] = (uint8_t)(dwLimb >> 10) & 0xFF;
- pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 2) & 0xFF;
- j += 2;
- }
- } else {
- dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 18) |
- ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 12) |
- ((uint32_t)g_inv_base64[pBuffer[i + 2]] << 6) |
- ((uint32_t)g_inv_base64[pBuffer[i + 3]]);
- pOutBuffer[j] = (uint8_t)(dwLimb >> 16) & 0xff;
- pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 8) & 0xff;
- pOutBuffer[j + 2] = (uint8_t)(dwLimb)&0xff;
- j += 3;
- }
- }
- FX_Free(pBuffer);
- return j;
-}
-
-static const FX_CHAR g_base64_chars[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) {
- FX_CHAR* out = nullptr;
- int i, j;
- uint32_t limb;
- out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5);
- for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) {
- limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) |
- ((uint32_t)buf[i + 2]);
- out[j] = g_base64_chars[(limb >> 18) & 63];
- out[j + 1] = g_base64_chars[(limb >> 12) & 63];
- out[j + 2] = g_base64_chars[(limb >> 6) & 63];
- out[j + 3] = g_base64_chars[(limb)&63];
- }
- switch (buf_len - i) {
- case 0:
- break;
- case 1:
- limb = ((uint32_t)buf[i]);
- out[j++] = g_base64_chars[(limb >> 2) & 63];
- out[j++] = g_base64_chars[(limb << 4) & 63];
- out[j++] = '=';
- out[j++] = '=';
- break;
- case 2:
- limb = ((uint32_t)buf[i] << 8) | ((uint32_t)buf[i + 1]);
- out[j++] = g_base64_chars[(limb >> 10) & 63];
- out[j++] = g_base64_chars[(limb >> 4) & 63];
- out[j++] = g_base64_chars[(limb << 2) & 63];
- out[j++] = '=';
- break;
- default:
- break;
- }
- out[j] = '\0';
- return out;
-}
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) {
- CFX_WideString wsContentType(wsType);
- wsContentType.MakeLower();
- if (wsContentType == L"image/jpg")
- return FXCODEC_IMAGE_JPG;
- if (wsContentType == L"image/png")
- return FXCODEC_IMAGE_PNG;
- if (wsContentType == L"image/gif")
- return FXCODEC_IMAGE_GIF;
- if (wsContentType == L"image/bmp")
- return FXCODEC_IMAGE_BMP;
- if (wsContentType == L"image/tif")
- return FXCODEC_IMAGE_TIF;
- return FXCODEC_IMAGE_UNKNOWN;
-}
-CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
- CXFA_Image* pImage,
- bool& bNameImage,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
- CFX_WideString wsHref;
- pImage->GetHref(wsHref);
- CFX_WideString wsImage;
- pImage->GetContent(wsImage);
- if (wsHref.IsEmpty() && wsImage.IsEmpty()) {
- return nullptr;
- }
- CFX_WideString wsContentType;
- pImage->GetContentType(wsContentType);
- FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
- CFX_ByteString bsContent;
- uint8_t* pImageBuffer = nullptr;
- CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead;
- if (wsImage.GetLength() > 0) {
- XFA_ATTRIBUTEENUM iEncoding =
- (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
- if (iEncoding == XFA_ATTRIBUTEENUM_Base64) {
- CFX_ByteString bsData = wsImage.UTF8Encode();
- int32_t iLength = bsData.GetLength();
- pImageBuffer = FX_Alloc(uint8_t, iLength);
- int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
- if (iRead > 0) {
- pImageFileRead = IFX_MemoryStream::Create(pImageBuffer, iRead);
- }
- } else {
- bsContent = CFX_ByteString::FromUnicode(wsImage);
- pImageFileRead = IFX_MemoryStream::Create(
- const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength());
- }
- } else {
- CFX_WideString wsURL = wsHref;
- if (wsURL.Left(7) != L"http://" && wsURL.Left(6) != L"ftp://") {
- CFX_DIBitmap* pBitmap =
- pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi);
- if (pBitmap) {
- bNameImage = true;
- return pBitmap;
- }
- }
- pImageFileRead = pDoc->GetDocEnvironment()->OpenLinkedFile(pDoc, wsURL);
- }
- if (!pImageFileRead) {
- FX_Free(pImageBuffer);
- return nullptr;
- }
- bNameImage = false;
- CFX_DIBitmap* pBitmap =
- XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi);
- FX_Free(pImageBuffer);
- return pBitmap;
-}
-static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
- int32_t iComponents,
- int32_t iBitsPerComponent) {
- FXDIB_Format dibFormat = FXDIB_Argb;
- switch (type) {
- case FXCODEC_IMAGE_BMP:
- case FXCODEC_IMAGE_JPG:
- case FXCODEC_IMAGE_TIF: {
- dibFormat = FXDIB_Rgb32;
- int32_t bpp = iComponents * iBitsPerComponent;
- if (bpp <= 24) {
- dibFormat = FXDIB_Rgb;
- }
- } break;
- case FXCODEC_IMAGE_PNG:
- default:
- break;
- }
- return dibFormat;
-}
-
-CFX_DIBitmap* XFA_LoadImageFromBuffer(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pImageFileRead,
- FXCODEC_IMAGE_TYPE type,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
- CFX_GEModule* pGeModule = CFX_GEModule::Get();
- if (!pGeModule)
- return nullptr;
-
- CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
- if (!pCodecMgr)
- return nullptr;
-
- CFX_DIBAttribute dibAttr;
- CFX_DIBitmap* pBitmap = nullptr;
- std::unique_ptr<CCodec_ProgressiveDecoder> pProgressiveDecoder =
- pCodecMgr->CreateProgressiveDecoder();
- pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr, false);
- switch (dibAttr.m_wDPIUnit) {
- case FXCODEC_RESUNIT_CENTIMETER:
- dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f);
- dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f);
- break;
- case FXCODEC_RESUNIT_METER:
- dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f);
- dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI / (FX_FLOAT)100 * 2.54f);
- break;
- default:
- break;
- }
- iImageXDpi = dibAttr.m_nXDPI > 1 ? dibAttr.m_nXDPI : (96);
- iImageYDpi = dibAttr.m_nYDPI > 1 ? dibAttr.m_nYDPI : (96);
- if (pProgressiveDecoder->GetWidth() > 0 &&
- pProgressiveDecoder->GetHeight() > 0) {
- type = pProgressiveDecoder->GetType();
- int32_t iComponents = pProgressiveDecoder->GetNumComponents();
- int32_t iBpc = pProgressiveDecoder->GetBPC();
- FXDIB_Format dibFormat = XFA_GetDIBFormat(type, iComponents, iBpc);
- pBitmap = new CFX_DIBitmap();
- pBitmap->Create(pProgressiveDecoder->GetWidth(),
- pProgressiveDecoder->GetHeight(), dibFormat);
- pBitmap->Clear(0xffffffff);
- int32_t nFrames;
- if ((pProgressiveDecoder->GetFrames(nFrames) ==
- FXCODEC_STATUS_DECODE_READY) &&
- (nFrames > 0)) {
- pProgressiveDecoder->StartDecode(pBitmap, 0, 0, pBitmap->GetWidth(),
- pBitmap->GetHeight());
- pProgressiveDecoder->ContinueDecode();
- }
- }
- return pBitmap;
-}
-
-void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, bool bUI) {
- if (!mg) {
- return;
- }
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
- mg.GetLeftInset(fLeftInset);
- mg.GetTopInset(fTopInset);
- mg.GetRightInset(fRightInset);
- mg.GetBottomInset(fBottomInset);
- rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
-}
-CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) {
- if (XFA_IsCreateWidget(pLayoutItem->GetFormNode()->GetElementType()))
- return static_cast<CXFA_FFWidget*>(pLayoutItem);
- return nullptr;
-}
-bool XFA_IsCreateWidget(XFA_Element eType) {
- return eType == XFA_Element::Field || eType == XFA_Element::Draw ||
- eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup;
-}
-static void XFA_BOX_GetPath_Arc(CXFA_Box box,
- CFX_RectF rtDraw,
- CFX_Path& fillPath,
- uint32_t dwFlags) {
- FX_FLOAT a, b;
- a = rtDraw.width / 2.0f;
- b = rtDraw.height / 2.0f;
- if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- a = b = std::min(a, b);
- }
- CFX_PointF center = rtDraw.Center();
- rtDraw.left = center.x - a;
- rtDraw.top = center.y - b;
- rtDraw.width = a + a;
- rtDraw.height = b + b;
- FX_FLOAT startAngle = 0, sweepAngle = 360;
- bool bStart = box.GetStartAngle(startAngle);
- bool bEnd = box.GetSweepAngle(sweepAngle);
- if (!bStart && !bEnd) {
- fillPath.AddEllipse(rtDraw);
- return;
- }
- startAngle = -startAngle * FX_PI / 180.0f;
- sweepAngle = -sweepAngle * FX_PI / 180.0f;
- fillPath.AddArc(rtDraw.TopLeft(), rtDraw.Size(), startAngle, sweepAngle);
-}
-
-static void XFA_BOX_GetPath(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_RectF rtWidget,
- CFX_Path& path,
- int32_t nIndex,
- bool bStart,
- bool bCorner) {
- ASSERT(nIndex >= 0 && nIndex < 8);
- int32_t n = (nIndex & 1) ? nIndex - 1 : nIndex;
- CXFA_Corner corner1(strokes[n].GetNode());
- CXFA_Corner corner2(strokes[(n + 2) % 8].GetNode());
- FX_FLOAT fRadius1 = bCorner ? corner1.GetRadius() : 0.0f;
- FX_FLOAT fRadius2 = bCorner ? corner2.GetRadius() : 0.0f;
- bool bInverted = corner1.IsInverted();
- FX_FLOAT offsetY = 0.0f;
- FX_FLOAT offsetX = 0.0f;
- bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round;
- FX_FLOAT halfAfter = 0.0f;
- FX_FLOAT halfBefore = 0.0f;
- CXFA_Stroke stroke = strokes[nIndex];
- if (stroke.IsCorner()) {
- CXFA_Stroke edgeBefore = strokes[(nIndex + 1 * 8 - 1) % 8];
- CXFA_Stroke edgeAfter = strokes[nIndex + 1];
- if (stroke.IsInverted()) {
- if (!stroke.SameStyles(edgeBefore)) {
- halfBefore = edgeBefore.GetThickness() / 2;
- }
- if (!stroke.SameStyles(edgeAfter)) {
- halfAfter = edgeAfter.GetThickness() / 2;
- }
- }
- } else {
- CXFA_Stroke edgeBefore = strokes[(nIndex + 8 - 2) % 8];
- CXFA_Stroke edgeAfter = strokes[(nIndex + 2) % 8];
- if (!bRound && !bInverted) {
- halfBefore = edgeBefore.GetThickness() / 2;
- halfAfter = edgeAfter.GetThickness() / 2;
- }
- }
- FX_FLOAT offsetEX = 0.0f;
- FX_FLOAT offsetEY = 0.0f;
- FX_FLOAT sx = 0.0f;
- FX_FLOAT sy = 0.0f;
- FX_FLOAT vx = 1.0f;
- FX_FLOAT vy = 1.0f;
- FX_FLOAT nx = 1.0f;
- FX_FLOAT ny = 1.0f;
- CFX_PointF cpStart;
- CFX_PointF cp1;
- CFX_PointF cp2;
- if (bRound) {
- sy = FX_PI / 2;
- }
- switch (nIndex) {
- case 0:
- case 1:
- cp1 = rtWidget.TopLeft();
- cp2 = rtWidget.TopRight();
- if (nIndex == 0) {
- cpStart.x = cp1.x - halfBefore;
- cpStart.y = cp1.y + fRadius1, offsetY = -halfAfter;
- } else {
- cpStart.x = cp1.x + fRadius1 - halfBefore, cpStart.y = cp1.y,
- offsetEX = halfAfter;
- }
- vx = 1, vy = 1;
- nx = -1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI / 2 : FX_PI;
- } else {
- sx = 1, sy = 0;
- }
- break;
- case 2:
- case 3:
- cp1 = rtWidget.TopRight();
- cp2 = rtWidget.BottomRight();
- if (nIndex == 2) {
- cpStart.x = cp1.x - fRadius1, cpStart.y = cp1.y - halfBefore,
- offsetX = halfAfter;
- } else {
- cpStart.x = cp1.x, cpStart.y = cp1.y + fRadius1 - halfBefore,
- offsetEY = halfAfter;
- }
- vx = -1, vy = 1;
- nx = 0, ny = -1;
- if (bRound) {
- sx = bInverted ? FX_PI : FX_PI * 3 / 2;
- } else {
- sx = 0, sy = 1;
- }
- break;
- case 4:
- case 5:
- cp1 = rtWidget.BottomRight();
- cp2 = rtWidget.BottomLeft();
- if (nIndex == 4) {
- cpStart.x = cp1.x + halfBefore, cpStart.y = cp1.y - fRadius1,
- offsetY = halfAfter;
- } else {
- cpStart.x = cp1.x - fRadius1 + halfBefore, cpStart.y = cp1.y,
- offsetEX = -halfAfter;
- }
- vx = -1, vy = -1;
- nx = 1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI * 3 / 2 : 0;
- } else {
- sx = -1, sy = 0;
- }
- break;
- case 6:
- case 7:
- cp1 = rtWidget.BottomLeft();
- cp2 = rtWidget.TopLeft();
- if (nIndex == 6) {
- cpStart.x = cp1.x + fRadius1, cpStart.y = cp1.y + halfBefore,
- offsetX = -halfAfter;
- } else {
- cpStart.x = cp1.x, cpStart.y = cp1.y - fRadius1 + halfBefore,
- offsetEY = -halfAfter;
- }
- vx = 1;
- vy = -1;
- nx = 0;
- ny = 1;
- if (bRound) {
- sx = bInverted ? 0 : FX_PI / 2;
- } else {
- sx = 0;
- sy = -1;
- }
- break;
- }
- if (bStart) {
- path.MoveTo(cpStart);
- }
- if (nIndex & 1) {
- path.LineTo(CFX_PointF(cp2.x + fRadius2 * nx + offsetEX,
- cp2.y + fRadius2 * ny + offsetEY));
- return;
- }
- if (bRound) {
- if (fRadius1 < 0)
- sx -= FX_PI;
- if (bInverted)
- sy *= -1;
-
- CFX_RectF rtRadius(cp1.x + offsetX * 2, cp1.y + offsetY * 2,
- fRadius1 * 2 * vx - offsetX * 2,
- fRadius1 * 2 * vy - offsetY * 2);
- rtRadius.Normalize();
- if (bInverted)
- rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
-
- path.ArcTo(rtRadius.TopLeft(), rtRadius.Size(), sx, sy);
- } else {
- CFX_PointF cp;
- if (bInverted) {
- cp.x = cp1.x + fRadius1 * vx;
- cp.y = cp1.y + fRadius1 * vy;
- } else {
- cp = cp1;
- }
- path.LineTo(cp);
- path.LineTo(CFX_PointF(cp1.x + fRadius1 * sx + offsetX,
- cp1.y + fRadius1 * sy + offsetY));
- }
-}
-static void XFA_BOX_GetFillPath(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_RectF rtWidget,
- CFX_Path& fillPath,
- uint16_t dwFlags) {
- if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- CXFA_Edge edge = box.GetEdge(0);
- FX_FLOAT fThickness = edge.GetThickness();
- if (fThickness < 0) {
- fThickness = 0;
- }
- FX_FLOAT fHalf = fThickness / 2;
- int32_t iHand = box.GetHand();
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.Inflate(fHalf, fHalf);
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.Deflate(fHalf, fHalf);
- }
- XFA_BOX_GetPath_Arc(box, rtWidget, fillPath, dwFlags);
- return;
- }
- bool bSameStyles = true;
- CXFA_Stroke stroke1 = strokes[0];
- for (int32_t i = 1; i < 8; i++) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- for (int32_t i = 2; i < 8; i += 2) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
- XFA_STROKE_SAMESTYLE_Corner)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- if (stroke1.IsInverted()) {
- bSameStyles = false;
- }
- if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) {
- bSameStyles = false;
- }
- }
- }
- if (bSameStyles) {
- fillPath.AddRectangle(rtWidget.left, rtWidget.top, rtWidget.width,
- rtWidget.height);
- return;
- }
-
- for (int32_t i = 0; i < 8; i += 2) {
- FX_FLOAT sx = 0.0f;
- FX_FLOAT sy = 0.0f;
- FX_FLOAT vx = 1.0f;
- FX_FLOAT vy = 1.0f;
- FX_FLOAT nx = 1.0f;
- FX_FLOAT ny = 1.0f;
- CFX_PointF cp1, cp2;
- CXFA_Corner corner1(strokes[i].GetNode());
- CXFA_Corner corner2(strokes[(i + 2) % 8].GetNode());
- FX_FLOAT fRadius1 = corner1.GetRadius();
- FX_FLOAT fRadius2 = corner2.GetRadius();
- bool bInverted = corner1.IsInverted();
- bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round;
- if (bRound) {
- sy = FX_PI / 2;
- }
- switch (i) {
- case 0:
- cp1 = rtWidget.TopLeft();
- cp2 = rtWidget.TopRight();
- vx = 1, vy = 1;
- nx = -1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI / 2 : FX_PI;
- } else {
- sx = 1, sy = 0;
- }
- break;
- case 2:
- cp1 = rtWidget.TopRight();
- cp2 = rtWidget.BottomRight();
- vx = -1, vy = 1;
- nx = 0, ny = -1;
- if (bRound) {
- sx = bInverted ? FX_PI : FX_PI * 3 / 2;
- } else {
- sx = 0, sy = 1;
- }
- break;
- case 4:
- cp1 = rtWidget.BottomRight();
- cp2 = rtWidget.BottomLeft();
- vx = -1, vy = -1;
- nx = 1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI * 3 / 2 : 0;
- } else {
- sx = -1, sy = 0;
- }
- break;
- case 6:
- cp1 = rtWidget.BottomLeft();
- cp2 = rtWidget.TopLeft();
- vx = 1, vy = -1;
- nx = 0, ny = 1;
- if (bRound) {
- sx = bInverted ? 0 : FX_PI / 2;
- } else {
- sx = 0;
- sy = -1;
- }
- break;
- }
- if (i == 0)
- fillPath.MoveTo(CFX_PointF(cp1.x, cp1.y + fRadius1));
-
- if (bRound) {
- if (fRadius1 < 0)
- sx -= FX_PI;
- if (bInverted)
- sy *= -1;
-
- CFX_RectF rtRadius(cp1.x, cp1.y, fRadius1 * 2 * vx, fRadius1 * 2 * vy);
- rtRadius.Normalize();
- if (bInverted)
- rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
-
- fillPath.ArcTo(rtRadius.TopLeft(), rtRadius.Size(), sx, sy);
- } else {
- CFX_PointF cp;
- if (bInverted) {
- cp.x = cp1.x + fRadius1 * vx;
- cp.y = cp1.y + fRadius1 * vy;
- } else {
- cp = cp1;
- }
- fillPath.LineTo(cp);
- fillPath.LineTo(CFX_PointF(cp1.x + fRadius1 * sx, cp1.y + fRadius1 * sy));
- }
- fillPath.LineTo(CFX_PointF(cp2.x + fRadius2 * nx, cp2.y + fRadius2 * ny));
- }
-}
-static void XFA_BOX_Fill_Radial(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_Path& fillPath,
- CFX_RectF rtFill,
- CFX_Matrix* pMatrix) {
- CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart, crEnd;
- crStart = fill.GetColor();
- int32_t iType = fill.GetRadial(crEnd);
- if (iType != XFA_ATTRIBUTEENUM_ToEdge) {
- FX_ARGB temp = crEnd;
- crEnd = crStart;
- crStart = temp;
- }
- CFX_Shading shading(rtFill.Center(), rtFill.Center(), 0,
- FXSYS_sqrt(rtFill.Width() * rtFill.Width() +
- rtFill.Height() * rtFill.Height()) /
- 2,
- true, true, crStart, crEnd);
- CFX_Color cr(&shading);
- pGS->SetFillColor(&cr);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Fill_Pattern(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_Path& fillPath,
- CFX_RectF rtFill,
- CFX_Matrix* pMatrix) {
- CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart, crEnd;
- crStart = fill.GetColor();
- int32_t iType = fill.GetPattern(crEnd);
- FX_HatchStyle iHatch = FX_HatchStyle::Cross;
- switch (iType) {
- case XFA_ATTRIBUTEENUM_CrossDiagonal:
- iHatch = FX_HatchStyle::DiagonalCross;
- break;
- case XFA_ATTRIBUTEENUM_DiagonalLeft:
- iHatch = FX_HatchStyle::ForwardDiagonal;
- break;
- case XFA_ATTRIBUTEENUM_DiagonalRight:
- iHatch = FX_HatchStyle::BackwardDiagonal;
- break;
- case XFA_ATTRIBUTEENUM_Horizontal:
- iHatch = FX_HatchStyle::Horizontal;
- break;
- case XFA_ATTRIBUTEENUM_Vertical:
- iHatch = FX_HatchStyle::Vertical;
- break;
- default:
- break;
- }
-
- CFX_Pattern pattern(iHatch, crEnd, crStart);
- CFX_Color cr(&pattern, 0x0);
- pGS->SetFillColor(&cr);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Fill_Linear(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_Path& fillPath,
- CFX_RectF rtFill,
- CFX_Matrix* pMatrix) {
- CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart = fill.GetColor();
- FX_ARGB crEnd;
- int32_t iType = fill.GetLinear(crEnd);
- CFX_PointF ptStart;
- CFX_PointF ptEnd;
- switch (iType) {
- case XFA_ATTRIBUTEENUM_ToRight:
- ptStart = CFX_PointF(rtFill.left, rtFill.top);
- ptEnd = CFX_PointF(rtFill.right(), rtFill.top);
- break;
- case XFA_ATTRIBUTEENUM_ToBottom:
- ptStart = CFX_PointF(rtFill.left, rtFill.top);
- ptEnd = CFX_PointF(rtFill.left, rtFill.bottom());
- break;
- case XFA_ATTRIBUTEENUM_ToLeft:
- ptStart = CFX_PointF(rtFill.right(), rtFill.top);
- ptEnd = CFX_PointF(rtFill.left, rtFill.top);
- break;
- case XFA_ATTRIBUTEENUM_ToTop:
- ptStart = CFX_PointF(rtFill.left, rtFill.bottom());
- ptEnd = CFX_PointF(rtFill.left, rtFill.top);
- break;
- default:
- break;
- }
- CFX_Shading shading(ptStart, ptEnd, false, false, crStart, crEnd);
- CFX_Color cr(&shading);
- pGS->SetFillColor(&cr);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Fill(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_Graphics* pGS,
- const CFX_RectF& rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- CXFA_Fill fill = box.GetFill();
- if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
- return;
-
- pGS->SaveGraphState();
- CFX_Path fillPath;
- XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath,
- (dwFlags & XFA_DRAWBOX_ForceRound) != 0);
- fillPath.Close();
- XFA_Element eType = fill.GetFillType();
- switch (eType) {
- case XFA_Element::Radial:
- XFA_BOX_Fill_Radial(box, pGS, fillPath, rtWidget, pMatrix);
- break;
- case XFA_Element::Pattern:
- XFA_BOX_Fill_Pattern(box, pGS, fillPath, rtWidget, pMatrix);
- break;
- case XFA_Element::Linear:
- XFA_BOX_Fill_Linear(box, pGS, fillPath, rtWidget, pMatrix);
- break;
- default: {
- FX_ARGB cr;
- if (eType == XFA_Element::Stipple) {
- int32_t iRate = fill.GetStipple(cr);
- if (iRate == 0) {
- iRate = 100;
- }
- int32_t a = 0;
- FX_COLORREF rgb;
- ArgbDecode(cr, a, rgb);
- cr = ArgbEncode(iRate * a / 100, rgb);
- } else {
- cr = fill.GetColor();
- }
- CFX_Color fillColor(cr);
- pGS->SetFillColor(&fillColor);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
- } break;
- }
- pGS->RestoreGraphState();
-}
-static void XFA_BOX_StrokePath(CXFA_Stroke stroke,
- CFX_Path* pPath,
- CFX_Graphics* pGS,
- CFX_Matrix* pMatrix) {
- if (!stroke || !stroke.IsVisible()) {
- return;
- }
- FX_FLOAT fThickness = stroke.GetThickness();
- if (fThickness < 0.001f) {
- return;
- }
- pGS->SaveGraphState();
- if (stroke.IsCorner() && fThickness > 2 * stroke.GetRadius()) {
- fThickness = 2 * stroke.GetRadius();
- }
- pGS->SetLineWidth(fThickness, true);
- pGS->SetLineCap(CFX_GraphStateData::LineCapButt);
- XFA_StrokeTypeSetLineDash(pGS, stroke.GetStrokeType(),
- XFA_ATTRIBUTEENUM_Butt);
- CFX_Color fxColor(stroke.GetColor());
- pGS->SetStrokeColor(&fxColor);
- pGS->StrokePath(pPath, pMatrix);
- pGS->RestoreGraphState();
-}
-static void XFA_BOX_StrokeArc(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_RectF rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- CXFA_Edge edge = box.GetEdge(0);
- if (!edge || !edge.IsVisible()) {
- return;
- }
- bool bVisible = false;
- FX_FLOAT fThickness = 0;
- int32_t i3DType = box.Get3DStyle(bVisible, fThickness);
- if (i3DType) {
- if (bVisible && fThickness >= 0.001f) {
- dwFlags |= XFA_DRAWBOX_Lowered3D;
- }
- }
- FX_FLOAT fHalf = edge.GetThickness() / 2;
- if (fHalf < 0) {
- fHalf = 0;
- }
- int32_t iHand = box.GetHand();
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.Inflate(fHalf, fHalf);
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.Deflate(fHalf, fHalf);
- }
- if ((dwFlags & XFA_DRAWBOX_ForceRound) == 0 ||
- (dwFlags & XFA_DRAWBOX_Lowered3D) == 0) {
- if (fHalf < 0.001f)
- return;
-
- CFX_Path arcPath;
- XFA_BOX_GetPath_Arc(box, rtWidget, arcPath, dwFlags);
- XFA_BOX_StrokePath(edge, &arcPath, pGS, pMatrix);
- return;
- }
- pGS->SaveGraphState();
- pGS->SetLineWidth(fHalf);
-
- FX_FLOAT a, b;
- a = rtWidget.width / 2.0f;
- b = rtWidget.height / 2.0f;
- if (dwFlags & XFA_DRAWBOX_ForceRound) {
- a = std::min(a, b);
- b = a;
- }
-
- CFX_PointF center = rtWidget.Center();
- rtWidget.left = center.x - a;
- rtWidget.top = center.y - b;
- rtWidget.width = a + a;
- rtWidget.height = b + b;
-
- FX_FLOAT startAngle = 0, sweepAngle = 360;
- startAngle = startAngle * FX_PI / 180.0f;
- sweepAngle = -sweepAngle * FX_PI / 180.0f;
-
- CFX_Path arcPath;
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
- FX_PI);
-
- CFX_Color cr(0xFF808080);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- arcPath.Clear();
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
- FX_PI);
-
- cr.Set(0xFFFFFFFF);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- rtWidget.Deflate(fHalf, fHalf);
- arcPath.Clear();
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
- FX_PI);
-
- cr.Set(0xFF404040);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- arcPath.Clear();
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
- FX_PI);
-
- cr.Set(0xFFC0C0C0);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- pGS->RestoreGraphState();
-}
-static void XFA_Draw3DRect(CFX_Graphics* pGraphic,
- const CFX_RectF& rt,
- FX_FLOAT fLineWidth,
- CFX_Matrix* pMatrix,
- FX_ARGB argbTopLeft,
- FX_ARGB argbBottomRight) {
- CFX_Color crLT(argbTopLeft);
- pGraphic->SetFillColor(&crLT);
- FX_FLOAT fBottom = rt.bottom();
- FX_FLOAT fRight = rt.right();
- CFX_Path pathLT;
- pathLT.MoveTo(CFX_PointF(rt.left, fBottom));
- pathLT.LineTo(CFX_PointF(rt.left, rt.top));
- pathLT.LineTo(CFX_PointF(fRight, rt.top));
- pathLT.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
- pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, rt.top + fLineWidth));
- pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
- pathLT.LineTo(CFX_PointF(rt.left, fBottom));
- pGraphic->FillPath(&pathLT, FXFILL_WINDING, pMatrix);
-
- CFX_Color crRB(argbBottomRight);
- pGraphic->SetFillColor(&crRB);
-
- CFX_Path pathRB;
- pathRB.MoveTo(CFX_PointF(fRight, rt.top));
- pathRB.LineTo(CFX_PointF(fRight, fBottom));
- pathRB.LineTo(CFX_PointF(rt.left, fBottom));
- pathRB.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
- pathRB.LineTo(CFX_PointF(fRight - fLineWidth, fBottom - fLineWidth));
- pathRB.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
- pathRB.LineTo(CFX_PointF(fRight, rt.top));
- pGraphic->FillPath(&pathRB, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Stroke_3DRect_Lowered(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- CFX_Color cr(0xFF000000);
- pGS->SetFillColor(&cr);
- CFX_Path path;
- path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
- path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
- pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFF808080, 0xFFC0C0C0);
-}
-static void XFA_BOX_Stroke_3DRect_Raised(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- CFX_Color cr(0xFF000000);
- pGS->SetFillColor(&cr);
- CFX_Path path;
- path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
- path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
- pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFFFFFFFF, 0xFF808080);
-}
-static void XFA_BOX_Stroke_3DRect_Etched(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFFFFFFFF);
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFFFFFFFF, 0xFF808080);
-}
-static void XFA_BOX_Stroke_3DRect_Embossed(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFF000000);
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFF000000, 0xFF808080);
-}
-static void XFA_BOX_Stroke_Rect(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_Graphics* pGS,
- CFX_RectF rtWidget,
- CFX_Matrix* pMatrix) {
- bool bVisible = false;
- FX_FLOAT fThickness = 0;
- int32_t i3DType = box.Get3DStyle(bVisible, fThickness);
- if (i3DType) {
- if (!bVisible || fThickness < 0.001f) {
- return;
- }
- switch (i3DType) {
- case XFA_ATTRIBUTEENUM_Lowered:
- XFA_BOX_Stroke_3DRect_Lowered(pGS, rtWidget, fThickness, pMatrix);
- break;
- case XFA_ATTRIBUTEENUM_Raised:
- XFA_BOX_Stroke_3DRect_Raised(pGS, rtWidget, fThickness, pMatrix);
- break;
- case XFA_ATTRIBUTEENUM_Etched:
- XFA_BOX_Stroke_3DRect_Etched(pGS, rtWidget, fThickness, pMatrix);
- break;
- case XFA_ATTRIBUTEENUM_Embossed:
- XFA_BOX_Stroke_3DRect_Embossed(pGS, rtWidget, fThickness, pMatrix);
- break;
- }
- return;
- }
- bool bClose = false;
- bool bSameStyles = true;
- CXFA_Stroke stroke1 = strokes[0];
- for (int32_t i = 1; i < 8; i++) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- bClose = true;
- for (int32_t i = 2; i < 8; i += 2) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
- XFA_STROKE_SAMESTYLE_Corner)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- if (stroke1.IsInverted())
- bSameStyles = false;
- if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square)
- bSameStyles = false;
- }
- }
- bool bStart = true;
- CFX_Path path;
- for (int32_t i = 0; i < 8; i++) {
- CXFA_Stroke stroke = strokes[i];
- if ((i % 1) == 0 && stroke.GetRadius() < 0) {
- bool bEmpty = path.IsEmpty();
- if (!bEmpty) {
- XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
- path.Clear();
- }
- bStart = true;
- continue;
- }
- XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles);
- CXFA_Stroke stroke2 = strokes[(i + 1) % 8];
- bStart = !stroke.SameStyles(stroke2);
- if (bStart) {
- XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
- path.Clear();
- }
- }
- bool bEmpty = path.IsEmpty();
- if (!bEmpty) {
- if (bClose) {
- path.Close();
- }
- XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix);
- }
-}
-static void XFA_BOX_Stroke(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_Graphics* pGS,
- CFX_RectF rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- XFA_BOX_StrokeArc(box, pGS, rtWidget, pMatrix, dwFlags);
- return;
- }
- bool bVisible = false;
- for (int32_t j = 0; j < 4; j++) {
- if (strokes[j * 2 + 1].IsVisible()) {
- bVisible = true;
- break;
- }
- }
- if (!bVisible) {
- return;
- }
- for (int32_t i = 1; i < 8; i += 2) {
- CXFA_Edge edge(strokes[i].GetNode());
- FX_FLOAT fThickness = edge.GetThickness();
- if (fThickness < 0) {
- fThickness = 0;
- }
- FX_FLOAT fHalf = fThickness / 2;
- int32_t iHand = box.GetHand();
- switch (i) {
- case 1:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.top -= fHalf;
- rtWidget.height += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.top += fHalf;
- rtWidget.height -= fHalf;
- }
- break;
- case 3:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.width += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.width -= fHalf;
- }
- break;
- case 5:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.height += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.height -= fHalf;
- }
- break;
- case 7:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.left -= fHalf;
- rtWidget.width += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.left += fHalf;
- rtWidget.width -= fHalf;
- }
- break;
- }
- }
- XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix);
-}
-void XFA_DrawBox(CXFA_Box box,
- CFX_Graphics* pGS,
- const CFX_RectF& rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
- return;
-
- XFA_Element eType = box.GetElementType();
- if (eType != XFA_Element::Arc && eType != XFA_Element::Border &&
- eType != XFA_Element::Rectangle) {
- return;
- }
- std::vector<CXFA_Stroke> strokes;
- if (!(dwFlags & XFA_DRAWBOX_ForceRound) && eType != XFA_Element::Arc)
- box.GetStrokes(&strokes);
-
- XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
- XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
-}
-
-CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {}
-
-CXFA_CalcData::~CXFA_CalcData() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index adc5c31cc66..760def2759f 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -13,1525 +13,26 @@
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/cfde_textout.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
-static void XFA_FFDeleteCalcData(void* pData) {
- if (pData) {
- delete ((CXFA_CalcData*)pData);
- }
-}
-
-static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteCalcData = {
- XFA_FFDeleteCalcData, nullptr};
-
-class CXFA_WidgetLayoutData {
- public:
- CXFA_WidgetLayoutData() : m_fWidgetHeight(-1) {}
- virtual ~CXFA_WidgetLayoutData() {}
-
- FX_FLOAT m_fWidgetHeight;
-};
-
-class CXFA_TextLayoutData : public CXFA_WidgetLayoutData {
- public:
- CXFA_TextLayoutData() {}
- ~CXFA_TextLayoutData() override {}
-
- CXFA_TextLayout* GetTextLayout() const { return m_pTextLayout.get(); }
- CXFA_TextProvider* GetTextProvider() const { return m_pTextProvider.get(); }
-
- void LoadText(CXFA_WidgetAcc* pAcc) {
- if (m_pTextLayout)
- return;
-
- m_pTextProvider =
- pdfium::MakeUnique<CXFA_TextProvider>(pAcc, XFA_TEXTPROVIDERTYPE_Text);
- m_pTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pTextProvider.get());
- }
-
- private:
- std::unique_ptr<CXFA_TextLayout> m_pTextLayout;
- std::unique_ptr<CXFA_TextProvider> m_pTextProvider;
-};
-
-class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData {
- public:
- CXFA_ImageLayoutData()
- : m_pDIBitmap(nullptr),
- m_bNamedImage(false),
- m_iImageXDpi(0),
- m_iImageYDpi(0) {}
-
- ~CXFA_ImageLayoutData() override {
- if (m_pDIBitmap && !m_bNamedImage)
- delete m_pDIBitmap;
- }
-
- bool LoadImageData(CXFA_WidgetAcc* pAcc) {
- if (m_pDIBitmap)
- return true;
-
- CXFA_Value value = pAcc->GetFormValue();
- if (!value)
- return false;
-
- CXFA_Image imageObj = value.GetImage();
- if (!imageObj)
- return false;
-
- CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
- pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage,
- m_iImageXDpi, m_iImageYDpi));
- return !!m_pDIBitmap;
- }
-
- CFX_DIBitmap* m_pDIBitmap;
- bool m_bNamedImage;
- int32_t m_iImageXDpi;
- int32_t m_iImageYDpi;
-};
-
-class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {
- public:
- CXFA_FieldLayoutData() {}
- ~CXFA_FieldLayoutData() override {}
-
- bool LoadCaption(CXFA_WidgetAcc* pAcc) {
- if (m_pCapTextLayout)
- return true;
- CXFA_Caption caption = pAcc->GetCaption();
- if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden)
- return false;
- m_pCapTextProvider.reset(
- new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption));
- m_pCapTextLayout =
- pdfium::MakeUnique<CXFA_TextLayout>(m_pCapTextProvider.get());
- return true;
- }
-
- std::unique_ptr<CXFA_TextLayout> m_pCapTextLayout;
- std::unique_ptr<CXFA_TextProvider> m_pCapTextProvider;
- std::unique_ptr<CFDE_TextOut> m_pTextOut;
- std::vector<FX_FLOAT> m_FieldSplitArray;
-};
-
-class CXFA_TextEditData : public CXFA_FieldLayoutData {
- public:
-};
-
-class CXFA_ImageEditData : public CXFA_FieldLayoutData {
- public:
- CXFA_ImageEditData()
- : m_pDIBitmap(nullptr),
- m_bNamedImage(false),
- m_iImageXDpi(0),
- m_iImageYDpi(0) {}
-
- ~CXFA_ImageEditData() override {
- if (m_pDIBitmap && !m_bNamedImage)
- delete m_pDIBitmap;
- }
-
- bool LoadImageData(CXFA_WidgetAcc* pAcc) {
- if (m_pDIBitmap)
- return true;
-
- CXFA_Value value = pAcc->GetFormValue();
- if (!value)
- return false;
-
- CXFA_Image imageObj = value.GetImage();
- CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
- pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage,
- m_iImageXDpi, m_iImageYDpi));
- return !!m_pDIBitmap;
- }
-
- CFX_DIBitmap* m_pDIBitmap;
- bool m_bNamedImage;
- int32_t m_iImageXDpi;
- int32_t m_iImageYDpi;
-};
-
-CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode)
- : CXFA_WidgetData(pNode),
- m_pDocView(pDocView),
- m_nRecursionDepth(0) {}
-
-CXFA_WidgetAcc::~CXFA_WidgetAcc() {}
-
-bool CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) {
- if (iNameType == 0) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
- return !wsName.IsEmpty();
- }
- m_pNode->GetSOMExpression(wsName);
- if (iNameType == 2 && wsName.GetLength() >= 15) {
- CFX_WideStringC wsPre = L"xfa[0].form[0].";
- if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) {
- wsName.Delete(0, wsPre.GetLength());
- }
- }
- return true;
-}
-CXFA_Node* CXFA_WidgetAcc::GetDatasets() {
- return m_pNode->GetBindData();
-}
-bool CXFA_WidgetAcc::ProcessValueChanged() {
- m_pDocView->AddValidateWidget(this);
- m_pDocView->AddCalculateWidgetAcc(this);
- m_pDocView->RunCalculateWidgets();
- m_pDocView->RunValidate();
- return true;
-}
-void CXFA_WidgetAcc::ResetData() {
- CFX_WideString wsValue;
- XFA_Element eUIType = GetUIType();
- switch (eUIType) {
- case XFA_Element::ImageEdit: {
- CXFA_Value imageValue = GetDefaultValue();
- CXFA_Image image = imageValue.GetImage();
- CFX_WideString wsContentType, wsHref;
- if (image) {
- image.GetContent(wsValue);
- image.GetContentType(wsContentType);
- image.GetHref(wsHref);
- }
- SetImageEdit(wsContentType, wsHref, wsValue);
- } break;
- case XFA_Element::ExclGroup: {
- CXFA_Node* pNextChild = m_pNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
- while (pNextChild) {
- CXFA_Node* pChild = pNextChild;
- CXFA_WidgetAcc* pAcc =
- static_cast<CXFA_WidgetAcc*>(pChild->GetWidgetData());
- if (!pAcc) {
- continue;
- }
- CXFA_Value defValue(nullptr);
- if (wsValue.IsEmpty() && (defValue = pAcc->GetDefaultValue())) {
- defValue.GetChildValueContent(wsValue);
- SetValue(wsValue, XFA_VALUEPICTURE_Raw);
- pAcc->SetValue(wsValue, XFA_VALUEPICTURE_Raw);
- } else {
- CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items);
- if (!pItems) {
- continue;
- }
- CFX_WideString itemText;
- if (pItems->CountChildren(XFA_Element::Unknown) > 1) {
- itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent();
- }
- pAcc->SetValue(itemText, XFA_VALUEPICTURE_Raw);
- }
- pNextChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode);
- }
- } break;
- case XFA_Element::ChoiceList:
- ClearAllSelections();
- default:
- if (CXFA_Value defValue = GetDefaultValue()) {
- defValue.GetChildValueContent(wsValue);
- }
- SetValue(wsValue, XFA_VALUEPICTURE_Raw);
- break;
- }
-}
-void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType,
- const CFX_WideString& wsHref,
- const CFX_WideString& wsData) {
- CXFA_Image image = GetFormValue().GetImage();
- if (image) {
- image.SetContentType(CFX_WideString(wsContentType));
- image.SetHref(wsHref);
- }
- CFX_WideString wsFormatValue(wsData);
- GetFormatDataValue(wsData, wsFormatValue);
- m_pNode->SetContent(wsData, wsFormatValue, true);
- CXFA_Node* pBind = GetDatasets();
- if (!pBind) {
- image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64);
- return;
- }
- pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
- CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (pHrefNode) {
- pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref);
- } else {
- CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
- ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element);
- static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"href", wsHref);
- }
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() {
- CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) {
- return nullptr;
- }
- return static_cast<CXFA_WidgetAcc*>(pExcl->GetWidgetData());
-}
-CXFA_FFDocView* CXFA_WidgetAcc::GetDocView() {
- return m_pDocView;
-}
-CXFA_FFDoc* CXFA_WidgetAcc::GetDoc() {
- return m_pDocView->GetDoc();
-}
-CXFA_FFApp* CXFA_WidgetAcc::GetApp() {
- return GetDoc()->GetApp();
-}
-IXFA_AppProvider* CXFA_WidgetAcc::GetAppProvider() {
- return GetApp()->GetAppProvider();
-}
-int32_t CXFA_WidgetAcc::ProcessEvent(int32_t iActivity,
- CXFA_EventParam* pEventParam) {
- if (GetElementType() == XFA_Element::Draw) {
- return XFA_EVENTERROR_NotExist;
- }
- int32_t iRet = XFA_EVENTERROR_NotExist;
- CXFA_NodeArray eventArray;
- int32_t iCounts =
- GetEventByActivity(iActivity, eventArray, pEventParam->m_bIsFormReady);
- for (int32_t i = 0; i < iCounts; i++) {
- CXFA_Event event(eventArray[i]);
- int32_t result = ProcessEvent(event, pEventParam);
- if (i == 0) {
- iRet = result;
- } else if (result == XFA_EVENTERROR_Success) {
- iRet = result;
- }
- }
- return iRet;
-}
-int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event,
- CXFA_EventParam* pEventParam) {
- if (!event)
- return XFA_EVENTERROR_NotExist;
-
- switch (event.GetEventType()) {
- case XFA_Element::Execute:
- break;
- case XFA_Element::Script: {
- CXFA_Script script = event.GetScript();
- return ExecuteScript(script, pEventParam);
- } break;
- case XFA_Element::SignData:
- break;
- case XFA_Element::Submit: {
- CXFA_Submit submit = event.GetSubmit();
- return GetDoc()->GetDocEnvironment()->SubmitData(GetDoc(), submit);
- }
- default:
- break;
- }
- return XFA_EVENTERROR_NotExist;
-}
-
-int32_t CXFA_WidgetAcc::ProcessCalculate() {
- if (GetElementType() == XFA_Element::Draw)
- return XFA_EVENTERROR_NotExist;
-
- CXFA_Calculate calc = GetCalculate();
- if (!calc)
- return XFA_EVENTERROR_NotExist;
- if (GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_Disabled;
-
- CXFA_EventParam EventParam;
- EventParam.m_eType = XFA_EVENT_Calculate;
- CXFA_Script script = calc.GetScript();
- int32_t iRet = ExecuteScript(script, &EventParam);
- if (iRet != XFA_EVENTERROR_Success)
- return iRet;
-
- if (GetRawValue() != EventParam.m_wsResult) {
- SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw);
- UpdateUIDisplay();
- }
- return XFA_EVENTERROR_Success;
-}
-
-void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
- int32_t iRet,
- CFXJSE_Value* pRetValue,
- bool bVersionFlag) {
- if (iRet == XFA_EVENTERROR_Success && pRetValue) {
- if (pRetValue->IsBoolean() && !pRetValue->ToBoolean()) {
- IXFA_AppProvider* pAppProvider = GetAppProvider();
- if (!pAppProvider) {
- return;
- }
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- CFX_WideString wsScriptMsg;
- validate.GetScriptMessageText(wsScriptMsg);
- int32_t eScriptTest = validate.GetScriptTest();
- if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) {
- if (GetNode()->IsUserInteractive())
- return;
- if (wsScriptMsg.IsEmpty())
- wsScriptMsg = GetValidateMessage(false, bVersionFlag);
-
- if (bVersionFlag) {
- pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_OK);
- return;
- }
- if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
- }
- } else {
- if (wsScriptMsg.IsEmpty())
- wsScriptMsg = GetValidateMessage(true, bVersionFlag);
- pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
- }
- }
- }
-}
-int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
- bool bVersionFlag) {
- CFX_WideString wsRawValue = GetRawValue();
- if (!wsRawValue.IsEmpty()) {
- CFX_WideString wsPicture;
- validate.GetPicture(wsPicture);
- if (wsPicture.IsEmpty()) {
- return XFA_EVENTERROR_NotExist;
- }
- IFX_Locale* pLocale = GetLocal();
- if (!pLocale) {
- return XFA_EVENTERROR_NotExist;
- }
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(this);
- if (!lcValue.ValidateValue(lcValue.GetValue(), wsPicture, pLocale)) {
- IXFA_AppProvider* pAppProvider = GetAppProvider();
- if (!pAppProvider) {
- return XFA_EVENTERROR_NotExist;
- }
- CFX_WideString wsFormatMsg;
- validate.GetFormatMessageText(wsFormatMsg);
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- int32_t eFormatTest = validate.GetFormatTest();
- if (eFormatTest == XFA_ATTRIBUTEENUM_Error) {
- if (wsFormatMsg.IsEmpty())
- wsFormatMsg = GetValidateMessage(true, bVersionFlag);
- pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
- return XFA_EVENTERROR_Success;
- }
- if (GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_NotExist;
- if (wsFormatMsg.IsEmpty())
- wsFormatMsg = GetValidateMessage(false, bVersionFlag);
-
- if (bVersionFlag) {
- pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_OK);
- return XFA_EVENTERROR_Success;
- }
- if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
- }
- return XFA_EVENTERROR_Success;
- }
- }
- return XFA_EVENTERROR_NotExist;
-}
-int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
- int32_t iFlags,
- bool bVersionFlag) {
- CFX_WideString wsValue;
- GetValue(wsValue, XFA_VALUEPICTURE_Raw);
- if (!wsValue.IsEmpty()) {
- return XFA_EVENTERROR_Success;
- }
- if (m_bIsNull && (m_bPreNull == m_bIsNull)) {
- return XFA_EVENTERROR_Success;
- }
- int32_t eNullTest = validate.GetNullTest();
- CFX_WideString wsNullMsg;
- validate.GetNullMessageText(wsNullMsg);
- if (iFlags & 0x01) {
- int32_t iRet = XFA_EVENTERROR_Success;
- if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- iRet = XFA_EVENTERROR_Error;
- }
- if (!wsNullMsg.IsEmpty()) {
- if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- m_pDocView->m_arrNullTestMsg.push_back(wsNullMsg);
- return XFA_EVENTERROR_Error;
- }
- return XFA_EVENTERROR_Success;
- }
- return iRet;
- }
- if (wsNullMsg.IsEmpty() && bVersionFlag &&
- eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- return XFA_EVENTERROR_Error;
- }
- IXFA_AppProvider* pAppProvider = GetAppProvider();
- if (!pAppProvider) {
- return XFA_EVENTERROR_NotExist;
- }
- CFX_WideString wsCaptionName;
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- switch (eNullTest) {
- case XFA_ATTRIBUTEENUM_Error: {
- if (wsNullMsg.IsEmpty()) {
- wsCaptionName = GetValidateCaptionName(bVersionFlag);
- wsNullMsg.Format(L"%s cannot be blank.", wsCaptionName.c_str());
- }
- pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
- return XFA_EVENTERROR_Error;
- }
- case XFA_ATTRIBUTEENUM_Warning: {
- if (GetNode()->IsUserInteractive())
- return true;
-
- if (wsNullMsg.IsEmpty()) {
- wsCaptionName = GetValidateCaptionName(bVersionFlag);
- wsNullMsg.Format(
- L"%s cannot be blank. To ignore validations for %s, click Ignore.",
- wsCaptionName.c_str(), wsCaptionName.c_str());
- }
- if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
- }
- return XFA_EVENTERROR_Error;
- }
- case XFA_ATTRIBUTEENUM_Disabled:
- default:
- break;
- }
- return XFA_EVENTERROR_Success;
-}
-
-CFX_WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
- CFX_WideString wsCaptionName;
-
- if (!bVersionFlag) {
- if (CXFA_Caption caption = GetCaption()) {
- if (CXFA_Value capValue = caption.GetValue()) {
- if (CXFA_Text capText = capValue.GetText())
- capText.GetContent(wsCaptionName);
- }
- }
- }
- if (wsCaptionName.IsEmpty())
- GetName(wsCaptionName);
-
- return wsCaptionName;
-}
-
-CFX_WideString CXFA_WidgetAcc::GetValidateMessage(bool bError,
- bool bVersionFlag) {
- CFX_WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
- CFX_WideString wsMessage;
- if (bVersionFlag) {
- wsMessage.Format(L"%s validation failed", wsCaptionName.c_str());
- return wsMessage;
- }
- if (bError) {
- wsMessage.Format(L"The value you entered for %s is invalid.",
- wsCaptionName.c_str());
- return wsMessage;
- }
- wsMessage.Format(
- L"The value you entered for %s is invalid. To ignore "
- L"validations for %s, click Ignore.",
- wsCaptionName.c_str(), wsCaptionName.c_str());
- return wsMessage;
-}
-
-int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
- if (GetElementType() == XFA_Element::Draw) {
- return XFA_EVENTERROR_NotExist;
- }
- CXFA_Validate validate = GetValidate();
- if (!validate) {
- return XFA_EVENTERROR_NotExist;
- }
- bool bInitDoc = validate.GetNode()->NeedsInitApp();
- bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End;
- int32_t iFormat = 0;
- CFXJSE_Value* pRetValue = nullptr;
- int32_t iRet = XFA_EVENTERROR_NotExist;
- CXFA_Script script = validate.GetScript();
- if (script) {
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Validate;
- eParam.m_pTarget = this;
- iRet = ExecuteScript(script, &eParam,
- ((bInitDoc || bStatus) && GetRawValue().IsEmpty())
- ? nullptr
- : &pRetValue);
- }
- XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
- bool bVersionFlag = false;
- if (version < XFA_VERSION_208) {
- bVersionFlag = true;
- }
- if (bInitDoc) {
- validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp);
- } else {
- iFormat = ProcessFormatTestValidate(validate, bVersionFlag);
- if (!bVersionFlag) {
- bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting);
- }
- iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag);
- }
- if (iFormat != XFA_EVENTERROR_Success) {
- ProcessScriptTestValidate(validate, iRet, pRetValue, bVersionFlag);
- }
- delete pRetValue;
-
- return iRet | iFormat;
-}
-int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
- CXFA_EventParam* pEventParam,
- CFXJSE_Value** pRetValue) {
- static const uint32_t MAX_RECURSION_DEPTH = 2;
- if (m_nRecursionDepth > MAX_RECURSION_DEPTH)
- return XFA_EVENTERROR_Success;
- ASSERT(pEventParam);
- if (!script) {
- return XFA_EVENTERROR_NotExist;
- }
- if (script.GetRunAt() == XFA_ATTRIBUTEENUM_Server) {
- return XFA_EVENTERROR_Disabled;
- }
- CFX_WideString wsExpression;
- script.GetExpression(wsExpression);
- if (wsExpression.IsEmpty()) {
- return XFA_EVENTERROR_NotExist;
- }
- XFA_SCRIPTTYPE eScriptType = script.GetContentType();
- if (eScriptType == XFA_SCRIPTTYPE_Unkown) {
- return XFA_EVENTERROR_Success;
- }
- CXFA_FFDoc* pDoc = GetDoc();
- CXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext();
- pContext->SetEventParam(*pEventParam);
- pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt());
- CXFA_NodeArray refNodes;
- if (pEventParam->m_eType == XFA_EVENT_InitCalculate ||
- pEventParam->m_eType == XFA_EVENT_Calculate) {
- pContext->SetNodesOfRunScript(&refNodes);
- }
- std::unique_ptr<CFXJSE_Value> pTmpRetValue(
- new CFXJSE_Value(pContext->GetRuntime()));
- ++m_nRecursionDepth;
- bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
- wsExpression.AsStringC(), pTmpRetValue.get(),
- m_pNode);
- --m_nRecursionDepth;
- int32_t iRet = XFA_EVENTERROR_Error;
- if (bRet) {
- iRet = XFA_EVENTERROR_Success;
- if (pEventParam->m_eType == XFA_EVENT_Calculate ||
- pEventParam->m_eType == XFA_EVENT_InitCalculate) {
- if (!pTmpRetValue->IsUndefined()) {
- if (!pTmpRetValue->IsNull())
- pEventParam->m_wsResult = pTmpRetValue->ToWideString();
-
- iRet = XFA_EVENTERROR_Success;
- } else {
- iRet = XFA_EVENTERROR_Error;
- }
- if (pEventParam->m_eType == XFA_EVENT_InitCalculate) {
- if ((iRet == XFA_EVENTERROR_Success) &&
- (GetRawValue() != pEventParam->m_wsResult)) {
- SetValue(pEventParam->m_wsResult, XFA_VALUEPICTURE_Raw);
- m_pDocView->AddValidateWidget(this);
- }
- }
- int32_t iRefs = refNodes.GetSize();
- for (int32_t r = 0; r < iRefs; r++) {
- CXFA_WidgetAcc* pRefAcc =
- static_cast<CXFA_WidgetAcc*>(refNodes[r]->GetWidgetData());
- if (pRefAcc && pRefAcc == this) {
- continue;
- }
- CXFA_Node* pRefNode = refNodes[r];
- CXFA_CalcData* pGlobalData =
- (CXFA_CalcData*)pRefNode->GetUserData(XFA_CalcData);
- if (!pGlobalData) {
- pGlobalData = new CXFA_CalcData;
- pRefNode->SetUserData(XFA_CalcData, pGlobalData,
- &gs_XFADeleteCalcData);
- }
- if (!pdfium::ContainsValue(pGlobalData->m_Globals, this))
- pGlobalData->m_Globals.push_back(this);
- }
- }
- }
- if (pRetValue)
- *pRetValue = pTmpRetValue.release();
-
- pContext->SetNodesOfRunScript(nullptr);
- return iRet;
-}
-CXFA_FFWidget* CXFA_WidgetAcc::GetNextWidget(CXFA_FFWidget* pWidget) {
- CXFA_LayoutItem* pLayout = nullptr;
- if (pWidget) {
- pLayout = pWidget->GetNext();
- } else {
- pLayout = m_pDocView->GetXFALayout()->GetLayoutItem(m_pNode);
- }
- return static_cast<CXFA_FFWidget*>(pLayout);
-}
-void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) {
- CXFA_FFWidget* pWidget = nullptr;
- while ((pWidget = GetNextWidget(pWidget)) != nullptr) {
- if (pWidget == pExcept || !pWidget->IsLoaded() ||
- (GetUIType() != XFA_Element::CheckButton && pWidget->IsFocused())) {
- continue;
- }
- pWidget->UpdateFWLData();
- pWidget->AddInvalidateRect();
- }
-}
-
-void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
- CXFA_Caption caption = GetCaption();
- if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
- return;
- }
- LoadCaption();
- XFA_Element eUIType = GetUIType();
- int32_t iCapPlacement = caption.GetPlacementType();
- FX_FLOAT fCapReserve = caption.GetReserve();
- const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top ||
- iCapPlacement == XFA_ATTRIBUTEENUM_Bottom;
- const bool bReserveExit = fCapReserve > 0.01;
- CXFA_TextLayout* pCapTextLayout =
- static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
- ->m_pCapTextLayout.get();
- if (pCapTextLayout) {
- if (!bVert && eUIType != XFA_Element::Button) {
- szCap.width = fCapReserve;
- }
- CFX_SizeF minSize;
- pCapTextLayout->CalcSize(minSize, szCap, szCap);
- if (bReserveExit) {
- bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve;
- }
- } else {
- FX_FLOAT fFontSize = 10.0f;
- if (CXFA_Font font = caption.GetFont()) {
- fFontSize = font.GetFontSize();
- } else if (CXFA_Font widgetfont = GetFont()) {
- fFontSize = widgetfont.GetFontSize();
- }
- if (bVert) {
- szCap.height = fCapReserve > 0 ? fCapReserve : fFontSize;
- } else {
- szCap.width = fCapReserve > 0 ? fCapReserve : 0;
- szCap.height = fFontSize;
- }
- }
- if (CXFA_Margin mgCap = caption.GetMargin()) {
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
- mgCap.GetLeftInset(fLeftInset);
- mgCap.GetTopInset(fTopInset);
- mgCap.GetRightInset(fRightInset);
- mgCap.GetBottomInset(fBottomInset);
- if (bReserveExit) {
- bVert ? (szCap.width += fLeftInset + fRightInset)
- : (szCap.height += fTopInset + fBottomInset);
- } else {
- szCap.width += fLeftInset + fRightInset;
- szCap.height += fTopInset + fBottomInset;
- }
- }
-}
-bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) {
- CFX_SizeF szCap;
- CalcCaptionSize(szCap);
- CFX_RectF rtUIMargin = GetUIMargin();
- size.width += rtUIMargin.left + rtUIMargin.width;
- size.height += rtUIMargin.top + rtUIMargin.height;
- if (szCap.width > 0 && szCap.height > 0) {
- int32_t iCapPlacement = GetCaption().GetPlacementType();
- switch (iCapPlacement) {
- case XFA_ATTRIBUTEENUM_Left:
- case XFA_ATTRIBUTEENUM_Right:
- case XFA_ATTRIBUTEENUM_Inline: {
- size.width += szCap.width;
- size.height = std::max(size.height, szCap.height);
- } break;
- case XFA_ATTRIBUTEENUM_Top:
- case XFA_ATTRIBUTEENUM_Bottom: {
- size.height += szCap.height;
- size.width = std::max(size.width, szCap.width);
- }
- default:
- break;
- }
- }
- return CalculateWidgetAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetRightInset(fRightInset);
- mgWidget.GetBottomInset(fBottomInset);
- size.width += fLeftInset + fRightInset;
- size.height += fTopInset + fBottomInset;
- }
- CXFA_Para para = GetPara();
- if (para)
- size.width += para.GetMarginLeft() + para.GetTextIndent();
-
- FX_FLOAT fVal = 0;
- FX_FLOAT fMin = 0;
- FX_FLOAT fMax = 0;
- if (GetWidth(fVal)) {
- size.width = fVal;
- } else {
- if (GetMinWidth(fMin))
- size.width = std::max(size.width, fMin);
- if (GetMaxWidth(fMax) && fMax > 0)
- size.width = std::min(size.width, fMax);
- }
- fVal = 0;
- fMin = 0;
- fMax = 0;
- if (GetHeight(fVal)) {
- size.height = fVal;
- } else {
- if (GetMinHeight(fMin))
- size.height = std::max(size.height, fMin);
- if (GetMaxHeight(fMax) && fMax > 0)
- size.height = std::min(size.height, fMax);
- }
- return true;
-}
-
-void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) {
- FX_FLOAT fFontSize = GetFontSize();
- CFX_WideString wsText;
- GetValue(wsText, XFA_VALUEPICTURE_Display);
- if (wsText.IsEmpty()) {
- size.height += fFontSize;
- return;
- }
-
- FX_WCHAR wcEnter = '\n';
- FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1);
- if (wsLast == wcEnter) {
- wsText = wsText + wcEnter;
- }
-
- CXFA_FieldLayoutData* layoutData =
- static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
- if (!layoutData->m_pTextOut) {
- layoutData->m_pTextOut = pdfium::MakeUnique<CFDE_TextOut>();
- CFDE_TextOut* pTextOut = layoutData->m_pTextOut.get();
- pTextOut->SetFont(GetFDEFont());
- pTextOut->SetFontSize(fFontSize);
- pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
- pTextOut->SetLineSpace(GetLineHeight());
- uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight;
- if (GetUIType() == XFA_Element::TextEdit && IsMultiLine()) {
- dwStyles |= FDE_TTOSTYLE_LineWrap;
- }
- pTextOut->SetStyles(dwStyles);
- }
- layoutData->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(),
- size);
-}
-bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
- if (size.width > 0) {
- CFX_SizeF szOrz = size;
- CFX_SizeF szCap;
- CalcCaptionSize(szCap);
- bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01;
- int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
- if (bCapExit) {
- iCapPlacement = GetCaption().GetPlacementType();
- switch (iCapPlacement) {
- case XFA_ATTRIBUTEENUM_Left:
- case XFA_ATTRIBUTEENUM_Right:
- case XFA_ATTRIBUTEENUM_Inline: {
- size.width -= szCap.width;
- }
- default:
- break;
- }
- }
- CFX_RectF rtUIMargin = GetUIMargin();
- size.width -= rtUIMargin.left + rtUIMargin.width;
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- size.width -= fLeftInset + fRightInset;
- }
- CalculateTextContentSize(size);
- size.height += rtUIMargin.top + rtUIMargin.height;
- if (bCapExit) {
- switch (iCapPlacement) {
- case XFA_ATTRIBUTEENUM_Left:
- case XFA_ATTRIBUTEENUM_Right:
- case XFA_ATTRIBUTEENUM_Inline: {
- size.height = std::max(size.height, szCap.height);
- } break;
- case XFA_ATTRIBUTEENUM_Top:
- case XFA_ATTRIBUTEENUM_Bottom: {
- size.height += szCap.height;
- }
- default:
- break;
- }
- }
- size.width = szOrz.width;
- return CalculateWidgetAutoSize(size);
- }
- CalculateTextContentSize(size);
- return CalculateFieldAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) {
- FX_FLOAT fCheckSize = GetCheckButtonSize();
- size = CFX_SizeF(fCheckSize, fCheckSize);
- return CalculateFieldAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) {
- CalcCaptionSize(size);
- return CalculateWidgetAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) {
- if (!GetImageImage()) {
- LoadImageImage();
- }
- size.clear();
- if (CFX_DIBitmap* pBitmap = GetImageImage()) {
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- GetImageDpi(iImageXDpi, iImageYDpi);
- CFX_RectF rtImage(
- 0, 0,
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
-
- CFX_RectF rtFit;
- if (GetWidth(rtFit.width)) {
- GetWidthWithoutMargin(rtFit.width);
- } else {
- rtFit.width = rtImage.width;
- }
- if (GetHeight(rtFit.height)) {
- GetHeightWithoutMargin(rtFit.height);
- } else {
- rtFit.height = rtImage.height;
- }
- size = rtFit.Size();
- }
- return CalculateWidgetAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) {
- if (!GetImageEditImage()) {
- LoadImageEditImage();
- }
- size.clear();
- if (CFX_DIBitmap* pBitmap = GetImageEditImage()) {
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- GetImageEditDpi(iImageXDpi, iImageYDpi);
- CFX_RectF rtImage(
- 0, 0,
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
-
- CFX_RectF rtFit;
- if (GetWidth(rtFit.width)) {
- GetWidthWithoutMargin(rtFit.width);
- } else {
- rtFit.width = rtImage.width;
- }
- if (GetHeight(rtFit.height)) {
- GetHeightWithoutMargin(rtFit.height);
- } else {
- rtFit.height = rtImage.height;
- }
- size.width = rtFit.width;
- size.height = rtFit.height;
- }
- return CalculateFieldAutoSize(size);
-}
-bool CXFA_WidgetAcc::LoadImageImage() {
- InitLayoutData();
- return static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get())
- ->LoadImageData(this);
-}
-bool CXFA_WidgetAcc::LoadImageEditImage() {
- InitLayoutData();
- return static_cast<CXFA_ImageEditData*>(m_pLayoutData.get())
- ->LoadImageData(this);
-}
-void CXFA_WidgetAcc::GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
- CXFA_ImageLayoutData* pData =
- static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get());
- iImageXDpi = pData->m_iImageXDpi;
- iImageYDpi = pData->m_iImageYDpi;
-}
-void CXFA_WidgetAcc::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
- CXFA_ImageEditData* pData =
- static_cast<CXFA_ImageEditData*>(m_pLayoutData.get());
- iImageXDpi = pData->m_iImageXDpi;
- iImageYDpi = pData->m_iImageYDpi;
-}
-bool CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) {
- LoadText();
- CXFA_TextLayout* pTextLayout =
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
- if (pTextLayout) {
- size.width = pTextLayout->StartLayout(size.width);
- size.height = pTextLayout->GetLayoutHeight();
- }
- return CalculateWidgetAutoSize(size);
-}
-void CXFA_WidgetAcc::LoadText() {
- InitLayoutData();
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->LoadText(this);
-}
-FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- fWidthCalc += fLeftInset + fRightInset;
- }
- FX_FLOAT fMin = 0, fMax = 0;
- if (GetMinWidth(fMin)) {
- fWidthCalc = std::max(fWidthCalc, fMin);
- }
- if (GetMaxWidth(fMax) && fMax > 0) {
- fWidthCalc = std::min(fWidthCalc, fMax);
- }
- return fWidthCalc;
-}
-FX_FLOAT CXFA_WidgetAcc::GetWidthWithoutMargin(FX_FLOAT fWidthCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- fWidthCalc -= fLeftInset + fRightInset;
- }
- return fWidthCalc;
-}
-FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fTopInset, fBottomInset;
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
- fHeightCalc += fTopInset + fBottomInset;
- }
- FX_FLOAT fMin = 0, fMax = 0;
- if (GetMinHeight(fMin)) {
- fHeightCalc = std::max(fHeightCalc, fMin);
- }
- if (GetMaxHeight(fMax) && fMax > 0) {
- fHeightCalc = std::min(fHeightCalc, fMax);
- }
- return fHeightCalc;
-}
-FX_FLOAT CXFA_WidgetAcc::GetHeightWithoutMargin(FX_FLOAT fHeightCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fTopInset, fBottomInset;
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
- fHeightCalc -= fTopInset + fBottomInset;
- }
- return fHeightCalc;
-}
-void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight) {
- InitLayoutData();
- XFA_Element eUIType = GetUIType();
- if (eUIType == XFA_Element::Text) {
- m_pLayoutData->m_fWidgetHeight = -1;
- GetHeight(m_pLayoutData->m_fWidgetHeight);
- StartTextLayout(fCalcWidth, fCalcHeight);
- return;
- }
- if (fCalcWidth > 0 && fCalcHeight > 0) {
- return;
- }
- m_pLayoutData->m_fWidgetHeight = -1;
- FX_FLOAT fWidth = 0;
- if (fCalcWidth > 0 && fCalcHeight < 0) {
- if (!GetHeight(fCalcHeight)) {
- CalculateAccWidthAndHeight(eUIType, fCalcWidth, fCalcHeight);
- }
- m_pLayoutData->m_fWidgetHeight = fCalcHeight;
- return;
- }
- if (fCalcWidth < 0 && fCalcHeight < 0) {
- if (!GetWidth(fWidth) || !GetHeight(fCalcHeight)) {
- CalculateAccWidthAndHeight(eUIType, fWidth, fCalcHeight);
- }
- fCalcWidth = fWidth;
- }
- m_pLayoutData->m_fWidgetHeight = fCalcHeight;
-}
-void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType,
- FX_FLOAT& fWidth,
- FX_FLOAT& fCalcHeight) {
- CFX_SizeF sz(fWidth, m_pLayoutData->m_fWidgetHeight);
- switch (eUIType) {
- case XFA_Element::Barcode:
- case XFA_Element::ChoiceList:
- case XFA_Element::Signature:
- CalculateFieldAutoSize(sz);
- break;
- case XFA_Element::ImageEdit:
- CalculateImageEditAutoSize(sz);
- break;
- case XFA_Element::Button:
- CalculatePushButtonAutoSize(sz);
- break;
- case XFA_Element::CheckButton:
- CalculateCheckButtonAutoSize(sz);
- break;
- case XFA_Element::DateTimeEdit:
- case XFA_Element::NumericEdit:
- case XFA_Element::PasswordEdit:
- case XFA_Element::TextEdit:
- CalculateTextEditAutoSize(sz);
- break;
- case XFA_Element::Image:
- CalculateImageAutoSize(sz);
- break;
- case XFA_Element::Arc:
- case XFA_Element::Line:
- case XFA_Element::Rectangle:
- case XFA_Element::Subform:
- case XFA_Element::ExclGroup:
- CalculateWidgetAutoSize(sz);
- break;
- default:
- break;
- }
- fWidth = sz.width;
- m_pLayoutData->m_fWidgetHeight = sz.height;
- fCalcHeight = sz.height;
-}
-bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) {
- XFA_Element eUIType = GetUIType();
- if (eUIType == XFA_Element::Subform) {
- return false;
- }
- if (eUIType != XFA_Element::Text && eUIType != XFA_Element::TextEdit &&
- eUIType != XFA_Element::NumericEdit &&
- eUIType != XFA_Element::PasswordEdit) {
- fCalcHeight = 0;
- return true;
- }
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fBottomInset = 0;
- if (iBlockIndex == 0) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
- }
- CFX_RectF rtUIMargin = GetUIMargin();
- fTopInset += rtUIMargin.top;
- fBottomInset += rtUIMargin.width;
- }
- if (eUIType == XFA_Element::Text) {
- FX_FLOAT fHeight = fCalcHeight;
- if (iBlockIndex == 0) {
- fCalcHeight = fCalcHeight - fTopInset;
- if (fCalcHeight < 0) {
- fCalcHeight = 0;
- }
- }
- CXFA_TextLayout* pTextLayout =
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
- pTextLayout->DoLayout(iBlockIndex, fCalcHeight, fCalcHeight,
- m_pLayoutData->m_fWidgetHeight - fTopInset);
- if (fCalcHeight != 0) {
- if (iBlockIndex == 0) {
- fCalcHeight = fCalcHeight + fTopInset;
- }
- if (fabs(fHeight - fCalcHeight) < XFA_FLOAT_PERCISION) {
- return false;
- }
- }
- return true;
- }
- XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
- FX_FLOAT fCapReserve = 0;
- if (iBlockIndex == 0) {
- CXFA_Caption caption = GetCaption();
- if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
- iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
- fCapReserve = caption.GetReserve();
- }
- if (iCapPlacement == XFA_ATTRIBUTEENUM_Top &&
- fCalcHeight < fCapReserve + fTopInset) {
- fCalcHeight = 0;
- return true;
- }
- if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom &&
- m_pLayoutData->m_fWidgetHeight - fCapReserve - fBottomInset) {
- fCalcHeight = 0;
- return true;
- }
- if (iCapPlacement != XFA_ATTRIBUTEENUM_Top) {
- fCapReserve = 0;
- }
- }
- CXFA_FieldLayoutData* pFieldData =
- static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
- int32_t iLinesCount = 0;
- FX_FLOAT fHeight = m_pLayoutData->m_fWidgetHeight;
- CFX_WideString wsText;
- GetValue(wsText, XFA_VALUEPICTURE_Display);
- if (wsText.IsEmpty()) {
- iLinesCount = 1;
- } else {
- if (!pFieldData->m_pTextOut) {
- FX_FLOAT fWidth = 0;
- GetWidth(fWidth);
- CalculateAccWidthAndHeight(eUIType, fWidth, fHeight);
- }
- iLinesCount = pFieldData->m_pTextOut->GetTotalLines();
- }
- std::vector<FX_FLOAT>* pFieldArray = &pFieldData->m_FieldSplitArray;
- int32_t iFieldSplitCount = pdfium::CollectionSize<int32_t>(*pFieldArray);
- for (int32_t i = 0; i < iBlockIndex * 3; i += 3) {
- iLinesCount -= (int32_t)(*pFieldArray)[i + 1];
- fHeight -= (*pFieldArray)[i + 2];
- }
- if (iLinesCount == 0) {
- return false;
- }
- FX_FLOAT fLineHeight = GetLineHeight();
- FX_FLOAT fFontSize = GetFontSize();
- FX_FLOAT fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize;
- FX_FLOAT fSpaceAbove = 0;
- FX_FLOAT fStartOffset = 0;
- if (fHeight > 0.1f && iBlockIndex == 0) {
- fStartOffset = fTopInset;
- fHeight -= (fTopInset + fBottomInset);
- if (CXFA_Para para = GetPara()) {
- fSpaceAbove = para.GetSpaceAbove();
- FX_FLOAT fSpaceBelow = para.GetSpaceBelow();
- fHeight -= (fSpaceAbove + fSpaceBelow);
- switch (para.GetVerticalAlign()) {
- case XFA_ATTRIBUTEENUM_Top:
- fStartOffset += fSpaceAbove;
- break;
- case XFA_ATTRIBUTEENUM_Middle:
- fStartOffset += ((fHeight - fTextHeight) / 2 + fSpaceAbove);
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- fStartOffset += (fHeight - fTextHeight + fSpaceAbove);
- break;
- }
- }
- if (fStartOffset < 0.1f)
- fStartOffset = 0;
- }
- for (int32_t i = iBlockIndex - 1; iBlockIndex > 0 && i < iBlockIndex; i++) {
- fStartOffset = (*pFieldArray)[i * 3] - (*pFieldArray)[i * 3 + 2];
- if (fStartOffset < 0.1f)
- fStartOffset = 0;
- }
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[0] = fStartOffset;
- } else {
- pFieldArray->push_back(fStartOffset);
- }
- XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
- bool bCanSplitNoContent = false;
- XFA_ATTRIBUTEENUM eLayoutMode;
- GetNode()
- ->GetNodeItem(XFA_NODEITEM_Parent)
- ->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, true);
- if ((eLayoutMode == XFA_ATTRIBUTEENUM_Position ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Row ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Table) &&
- version > XFA_VERSION_208) {
- bCanSplitNoContent = true;
- }
- if ((eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Row ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Table) &&
- version <= XFA_VERSION_208) {
- if (fStartOffset < fCalcHeight) {
- bCanSplitNoContent = true;
- } else {
- fCalcHeight = 0;
- return true;
- }
- }
- if (bCanSplitNoContent) {
- if ((fCalcHeight - fTopInset - fSpaceAbove < fLineHeight)) {
- fCalcHeight = 0;
- return true;
- }
- if (fStartOffset + XFA_FLOAT_PERCISION >= fCalcHeight) {
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
- } else {
- pFieldArray->push_back(0);
- pFieldArray->push_back(fCalcHeight);
- }
- return false;
- }
- if (fCalcHeight - fStartOffset < fLineHeight) {
- fCalcHeight = fStartOffset;
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
- } else {
- pFieldArray->push_back(0);
- pFieldArray->push_back(fCalcHeight);
- }
- return true;
- }
- FX_FLOAT fTextNum =
- fCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset;
- int32_t iLineNum =
- (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight);
- if (iLineNum >= iLinesCount) {
- if (fCalcHeight - fStartOffset - fTextHeight >= fFontSize) {
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = (FX_FLOAT)iLinesCount;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
- } else {
- pFieldArray->push_back((FX_FLOAT)iLinesCount);
- pFieldArray->push_back(fCalcHeight);
- }
- return false;
- }
- if (fHeight - fStartOffset - fTextHeight < fFontSize) {
- iLineNum -= 1;
- if (iLineNum == 0) {
- fCalcHeight = 0;
- return true;
- }
- } else {
- iLineNum = (int32_t)(fTextNum / fLineHeight);
- }
- }
- if (iLineNum > 0) {
- FX_FLOAT fSplitHeight =
- iLineNum * fLineHeight + fCapReserve + fStartOffset;
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = (FX_FLOAT)iLineNum;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fSplitHeight;
- } else {
- pFieldArray->push_back((FX_FLOAT)iLineNum);
- pFieldArray->push_back(fSplitHeight);
- }
- if (fabs(fSplitHeight - fCalcHeight) < XFA_FLOAT_PERCISION) {
- return false;
- }
- fCalcHeight = fSplitHeight;
- return true;
- }
- }
- fCalcHeight = 0;
- return true;
-}
-void CXFA_WidgetAcc::InitLayoutData() {
- if (m_pLayoutData) {
- return;
- }
- switch (GetUIType()) {
- case XFA_Element::Text:
- m_pLayoutData = pdfium::MakeUnique<CXFA_TextLayoutData>();
- return;
- case XFA_Element::TextEdit:
- m_pLayoutData = pdfium::MakeUnique<CXFA_TextEditData>();
- return;
- case XFA_Element::Image:
- m_pLayoutData = pdfium::MakeUnique<CXFA_ImageLayoutData>();
- return;
- case XFA_Element::ImageEdit:
- m_pLayoutData = pdfium::MakeUnique<CXFA_ImageEditData>();
- return;
- default:
- break;
- }
- if (GetElementType() == XFA_Element::Field) {
- m_pLayoutData = pdfium::MakeUnique<CXFA_FieldLayoutData>();
- return;
- }
- m_pLayoutData = pdfium::MakeUnique<CXFA_WidgetLayoutData>();
-}
-
-void CXFA_WidgetAcc::StartTextLayout(FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight) {
- LoadText();
- CXFA_TextLayout* pTextLayout =
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
- FX_FLOAT fTextHeight = 0;
- if (fCalcWidth > 0 && fCalcHeight > 0) {
- FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth);
- pTextLayout->StartLayout(fWidth);
- fTextHeight = fCalcHeight;
- fTextHeight = GetHeightWithoutMargin(fTextHeight);
- pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight);
- return;
- }
- if (fCalcWidth > 0 && fCalcHeight < 0) {
- FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth);
- pTextLayout->StartLayout(fWidth);
- }
- if (fCalcWidth < 0 && fCalcHeight < 0) {
- FX_FLOAT fMaxWidth = -1;
- bool bRet = GetWidth(fMaxWidth);
- if (bRet) {
- FX_FLOAT fWidth = GetWidthWithoutMargin(fMaxWidth);
- pTextLayout->StartLayout(fWidth);
- } else {
- FX_FLOAT fWidth = pTextLayout->StartLayout(fMaxWidth);
- fMaxWidth = CalculateWidgetAutoWidth(fWidth);
- fWidth = GetWidthWithoutMargin(fMaxWidth);
- pTextLayout->StartLayout(fWidth);
- }
- fCalcWidth = fMaxWidth;
- }
- if (m_pLayoutData->m_fWidgetHeight < 0) {
- m_pLayoutData->m_fWidgetHeight = pTextLayout->GetLayoutHeight();
- m_pLayoutData->m_fWidgetHeight =
- CalculateWidgetAutoHeight(m_pLayoutData->m_fWidgetHeight);
- }
- fTextHeight = m_pLayoutData->m_fWidgetHeight;
- fTextHeight = GetHeightWithoutMargin(fTextHeight);
- pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight);
- fCalcHeight = m_pLayoutData->m_fWidgetHeight;
-}
-bool CXFA_WidgetAcc::LoadCaption() {
- InitLayoutData();
- return static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
- ->LoadCaption(this);
-}
-CXFA_TextLayout* CXFA_WidgetAcc::GetCaptionTextLayout() {
- return m_pLayoutData
- ? static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
- ->m_pCapTextLayout.get()
- : nullptr;
-}
-CXFA_TextLayout* CXFA_WidgetAcc::GetTextLayout() {
- return m_pLayoutData
- ? static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())
- ->GetTextLayout()
- : nullptr;
-}
-CFX_DIBitmap* CXFA_WidgetAcc::GetImageImage() {
- return m_pLayoutData
- ? static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get())
- ->m_pDIBitmap
- : nullptr;
-}
-CFX_DIBitmap* CXFA_WidgetAcc::GetImageEditImage() {
- return m_pLayoutData
- ? static_cast<CXFA_ImageEditData*>(m_pLayoutData.get())
- ->m_pDIBitmap
- : nullptr;
-}
-
-void CXFA_WidgetAcc::SetImageImage(CFX_DIBitmap* newImage) {
- CXFA_ImageLayoutData* pData =
- static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get());
- if (pData->m_pDIBitmap == newImage)
- return;
-
- if (pData->m_pDIBitmap && !pData->m_bNamedImage)
- delete pData->m_pDIBitmap;
-
- pData->m_pDIBitmap = newImage;
-}
-
-void CXFA_WidgetAcc::SetImageEditImage(CFX_DIBitmap* newImage) {
- CXFA_ImageEditData* pData =
- static_cast<CXFA_ImageEditData*>(m_pLayoutData.get());
- if (pData->m_pDIBitmap == newImage)
- return;
-
- if (pData->m_pDIBitmap && !pData->m_bNamedImage)
- delete pData->m_pDIBitmap;
-
- pData->m_pDIBitmap = newImage;
-}
-
-CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() {
- return m_pLayoutData.get();
-}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() {
- CFX_WideStringC wsFontName = L"Courier";
- uint32_t dwFontStyle = 0;
- if (CXFA_Font font = GetFont()) {
- if (font.IsBold())
- dwFontStyle |= FX_FONTSTYLE_Bold;
- if (font.IsItalic())
- dwFontStyle |= FX_FONTSTYLE_Italic;
- font.GetTypeface(wsFontName);
- }
-
- auto pDoc = GetDoc();
- return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName,
- dwFontStyle);
-}
-FX_FLOAT CXFA_WidgetAcc::GetFontSize() {
- FX_FLOAT fFontSize = 10.0f;
- if (CXFA_Font font = GetFont()) {
- fFontSize = font.GetFontSize();
- }
- return fFontSize < 0.1f ? 10.0f : fFontSize;
-}
-FX_FLOAT CXFA_WidgetAcc::GetLineHeight() {
- FX_FLOAT fLineHeight = 0;
- if (CXFA_Para para = GetPara()) {
- fLineHeight = para.GetLineHeight();
- }
- if (fLineHeight < 1) {
- fLineHeight = GetFontSize() * 1.2f;
- }
- return fLineHeight;
-}
-FX_ARGB CXFA_WidgetAcc::GetTextColor() {
- if (CXFA_Font font = GetFont()) {
- return font.GetColor();
- }
- return 0xFF000000;
-}
CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
bRichText = false;
if (m_pTextNode) {
@@ -1636,7 +137,7 @@ CXFA_Font CXFA_TextProvider::GetFontNode() {
bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() {
XFA_Element eType = m_pWidgetAcc->GetUIType();
if (eType == XFA_Element::CheckButton) {
- FX_FLOAT fWidth = 0;
+ float fWidth = 0;
return !m_pWidgetAcc->GetWidth(fWidth);
}
return false;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h
index 2daa35e6cd5..c4988fde661 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h
@@ -9,7 +9,7 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/fxfa_widget.h"
+#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_para.h"
@@ -44,7 +44,7 @@ class CXFA_TextProvider {
const CFX_WideString& wsAttr,
CFX_WideString& wsValue);
- protected:
+ private:
CXFA_WidgetAcc* m_pWidgetAcc;
XFA_TEXTPROVIDERTYPE m_eType;
CXFA_Node* m_pTextNode;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp
deleted file mode 100644
index 2fddfb61569..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ /dev/null
@@ -1,533 +0,0 @@
-// 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/fxfa/xfa_ffwidgethandler.h"
-
-#include <vector>
-
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
-#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-
-CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView)
- : m_pDocView(pDocView) {}
-
-CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {}
-
-bool CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) {
- m_pDocView->LockUpdate();
- bool bRet = hWidget->OnMouseEnter();
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) {
- m_pDocView->LockUpdate();
- bool bRet = hWidget->OnMouseExit();
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- m_pDocView->LockUpdate();
- bool bRet = hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point));
- if (bRet && m_pDocView->SetFocus(hWidget)) {
- m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
- m_pDocView->GetDoc(), hWidget);
- }
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- m_pDocView->LockUpdate();
- m_pDocView->m_bLayoutEvent = true;
- bool bRet = hWidget->OnLButtonUp(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnLButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnMouseMove(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- int16_t zDelta,
- const CFX_PointF& point) {
- bool bRet =
- hWidget->OnMouseWheel(dwFlags, zDelta, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point));
- if (bRet && m_pDocView->SetFocus(hWidget)) {
- m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
- m_pDocView->GetDoc(), hWidget);
- }
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnRButtonUp(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnRButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget,
- uint32_t dwKeyCode,
- uint32_t dwFlags) {
- bool bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags);
- m_pDocView->RunInvalidate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget,
- uint32_t dwKeyCode,
- uint32_t dwFlags) {
- bool bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags);
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget,
- uint32_t dwChar,
- uint32_t dwFlags) {
- bool bRet = hWidget->OnChar(dwChar, dwFlags);
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget,
- const CFX_PointF& point) {
- if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible))
- return FWL_WidgetHit::Unknown;
- return hWidget->OnHitTest(hWidget->Rotate2Normal(point));
-}
-
-bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget,
- const CFX_PointF& point) {
- return hWidget->OnSetCursor(hWidget->Rotate2Normal(point));
-}
-
-void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
- CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- bool bHighlight) {
- hWidget->RenderWidget(pGS, pMatrix,
- bHighlight ? XFA_WidgetStatus_Highlight : 0);
-}
-
-bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
- XFA_EVENTTYPE eEventType) {
- if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown)
- return false;
- if (pWidgetAcc->GetElementType() == XFA_Element::Draw)
- return false;
-
- switch (eEventType) {
- case XFA_EVENT_Calculate: {
- CXFA_Calculate calc = pWidgetAcc->GetCalculate();
- if (!calc)
- return false;
- if (calc.GetScript())
- return true;
- return false;
- }
- case XFA_EVENT_Validate: {
- CXFA_Validate val = pWidgetAcc->GetValidate();
- if (!val)
- return false;
- if (val.GetScript())
- return true;
- return false;
- }
- default:
- break;
- }
- CXFA_NodeArray eventArray;
- return pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType],
- eventArray) > 0;
-}
-
-int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
- CXFA_EventParam* pParam) {
- if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
- return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
- return XFA_EVENTERROR_NotExist;
-
- switch (pParam->m_eType) {
- case XFA_EVENT_Calculate:
- return pWidgetAcc->ProcessCalculate();
- case XFA_EVENT_Validate:
- if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled(
- m_pDocView->GetDoc())) {
- return pWidgetAcc->ProcessValidate();
- }
- return XFA_EVENTERROR_Disabled;
- case XFA_EVENT_InitCalculate: {
- CXFA_Calculate calc = pWidgetAcc->GetCalculate();
- if (!calc)
- return XFA_EVENTERROR_NotExist;
- if (pWidgetAcc->GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_Disabled;
-
- CXFA_Script script = calc.GetScript();
- return pWidgetAcc->ExecuteScript(script, pParam);
- }
- default:
- break;
- }
- int32_t iRet =
- pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
- return iRet;
-}
-
-CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent,
- XFA_WIDGETTYPE eType,
- CXFA_FFWidget* hBefore) {
- CXFA_Node* pParentFormItem =
- hParent ? hParent->GetDataAcc()->GetNode() : nullptr;
- CXFA_Node* pBeforeFormItem =
- hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr;
- CXFA_Node* pNewFormItem =
- CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem);
- if (!pNewFormItem)
- return nullptr;
-
- pNewFormItem->GetTemplateNode()->SetFlag(XFA_NodeFlag_Initialized, true);
- pNewFormItem->SetFlag(XFA_NodeFlag_Initialized, true);
- m_pDocView->RunLayout();
- CXFA_LayoutItem* pLayout =
- m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);
- return static_cast<CXFA_FFWidget*>(pLayout);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
- XFA_WIDGETTYPE eType,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- switch (eType) {
- case XFA_WIDGETTYPE_Barcode:
- return nullptr;
- case XFA_WIDGETTYPE_PushButton:
- return CreatePushButton(pParent, pBefore);
- case XFA_WIDGETTYPE_CheckButton:
- return CreateCheckButton(pParent, pBefore);
- case XFA_WIDGETTYPE_ExcludeGroup:
- return CreateExclGroup(pParent, pBefore);
- case XFA_WIDGETTYPE_RadioButton:
- return CreateRadioButton(pParent, pBefore);
- case XFA_WIDGETTYPE_Arc:
- return CreateArc(pParent, pBefore);
- case XFA_WIDGETTYPE_Rectangle:
- return CreateRectangle(pParent, pBefore);
- case XFA_WIDGETTYPE_Image:
- return CreateImage(pParent, pBefore);
- case XFA_WIDGETTYPE_Line:
- return CreateLine(pParent, pBefore);
- case XFA_WIDGETTYPE_Text:
- return CreateText(pParent, pBefore);
- case XFA_WIDGETTYPE_DatetimeEdit:
- return CreateDatetimeEdit(pParent, pBefore);
- case XFA_WIDGETTYPE_DecimalField:
- return CreateDecimalField(pParent, pBefore);
- case XFA_WIDGETTYPE_NumericField:
- return CreateNumericField(pParent, pBefore);
- case XFA_WIDGETTYPE_Signature:
- return CreateSignature(pParent, pBefore);
- case XFA_WIDGETTYPE_TextEdit:
- return CreateTextEdit(pParent, pBefore);
- case XFA_WIDGETTYPE_DropdownList:
- return CreateDropdownList(pParent, pBefore);
- case XFA_WIDGETTYPE_ListBox:
- return CreateListBox(pParent, pBefore);
- case XFA_WIDGETTYPE_ImageField:
- return CreateImageField(pParent, pBefore);
- case XFA_WIDGETTYPE_PasswordEdit:
- return CreatePasswordEdit(pParent, pBefore);
- case XFA_WIDGETTYPE_Subform:
- return CreateSubform(pParent, pBefore);
- default:
- return nullptr;
- }
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::Button, pParent, pBefore);
- CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField);
- CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption);
- CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue);
- pText->SetContent(L"Button", L"Button", false);
-
- CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption);
- pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, false);
- pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, false);
- CreateFontNode(pCaption);
-
- CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField);
- pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, false);
-
- CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder);
- pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, false);
-
- CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder);
- CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill);
- pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", false);
-
- CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
- pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
-
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::CheckButton, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateExclGroup(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateFormItem(XFA_Element::ExclGroup, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::CheckButton, pParent, pBefore);
- CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_Element::Ui);
- CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_Element::CheckButton);
- pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDatetimeEdit(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::DateTimeEdit, pParent, pBefore);
- CreateValueNode(XFA_Element::Date, pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDecimalField(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateNumericField(pParent, pBefore);
- CreateValueNode(XFA_Element::Decimal, pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateNumericField(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::NumericEdit, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateSignature(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::Signature, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateTextEdit(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::TextEdit, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDropdownList(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::ChoiceList, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDropdownList(pParent, pBefore);
- CXFA_Node* pUi = pField->GetNodeItem(XFA_NODEITEM_FirstChild);
- CXFA_Node* pListBox = pUi->GetNodeItem(XFA_NODEITEM_FirstChild);
- pListBox->SetEnum(XFA_ATTRIBUTE_Open, XFA_ATTRIBUTEENUM_Always);
- pListBox->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::ImageEdit, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore);
- CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
- pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, false);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateFormItem(XFA_Element::Field, pParent, pBefore);
- CreateCopyNode(eElement, CreateCopyNode(XFA_Element::Ui, pField));
- CreateFontNode(pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateArc(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateDraw(XFA_Element::Arc, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateRectangle(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateDraw(XFA_Element::Rectangle, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateImage(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDraw(XFA_Element::Image, pParent, pBefore);
- CreateCopyNode(XFA_Element::ImageEdit,
- CreateCopyNode(XFA_Element::Ui, pField));
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateLine(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateDraw(XFA_Element::Line, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateText(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDraw(XFA_Element::Text, pParent, pBefore);
- CreateCopyNode(XFA_Element::TextEdit,
- CreateCopyNode(XFA_Element::Ui, pField));
- CreateFontNode(pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pDraw = CreateFormItem(XFA_Element::Draw, pParent, pBefore);
- CreateValueNode(eElement, pDraw);
- return pDraw;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateFormItem(XFA_Element::Subform, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr;
- CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(false);
- if (pParent)
- pParent->InsertChild(pNewFormItem, pBefore);
- return pNewFormItem;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr;
- CXFA_Node* pNewNode =
- CreateTemplateNode(eElement, pTemplateParent,
- pBefore ? pBefore->GetTemplateNode() : nullptr)
- ->Clone(false);
- if (pParent)
- pParent->InsertChild(pNewNode, pBefore);
- return pNewNode;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Document* pXFADoc = GetXFADoc();
- CXFA_Node* pNewTemplateNode =
- pXFADoc->CreateNode(XFA_XDPPACKET_Template, eElement);
- if (pParent)
- pParent->InsertChild(pNewTemplateNode, pBefore);
- return pNewTemplateNode;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const {
- CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent);
- pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", false);
- return pFont;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
- uint32_t dwFlags,
- FX_FLOAT fInsets[4]) const {
- CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent);
- if (dwFlags & 0x01)
- pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset,
- CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), false);
- if (dwFlags & 0x02)
- pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset,
- CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), false);
- if (dwFlags & 0x04)
- pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset,
- CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), false);
- if (dwFlags & 0x08)
- pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset,
- CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), false);
- return pMargin;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_Element eValue,
- CXFA_Node* pParent) const {
- CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pParent);
- CreateCopyNode(eValue, pValue);
- return pValue;
-}
-
-CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const {
- return GetXFADoc();
-}
-
-CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const {
- return m_pDocView->GetDoc()->GetXFADoc();
-}
-
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp
deleted file mode 100644
index 5db389663a6..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp
+++ /dev/null
@@ -1,2055 +0,0 @@
-// 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/fxfa/xfa_fontmgr.h"
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-
-#include "core/fpdfapi/font/cpdf_font.h"
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_document.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-
-namespace {
-
-// The 5 names per entry are: PsName, Normal, Bold, Italic, BoldItalic.
-const char* const g_XFAPDFFontName[][5] = {
- {"Adobe PI Std", "AdobePIStd", "AdobePIStd", "AdobePIStd", "AdobePIStd"},
- {"Myriad Pro Light", "MyriadPro-Light", "MyriadPro-Semibold",
- "MyriadPro-LightIt", "MyriadPro-SemiboldIt"},
-};
-
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun", L"Arial", 0, 936},
- {0x01e4f102, L"YouYuan", L"Arial", 1, 936},
- {0x030549dc, L"LiSu", L"Arial", 1, 936},
- {0x032edd44, L"Simhei", L"Arial", 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular", L"Arial", 2, 1252},
- {0x03ed90e6, L"Nina", L"Arial", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain", L"Arial", 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif", L"Arial", 0, 1252},
- {0x089b18a9, L"Arial", L"Arial", 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva", L"Arial", 8, 1252},
- {0x0bb003e7, L"Kartika", L"Arial", 2, 1252},
- {0x0bb469df, L"VinerHandITC", L"Arial", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Arial", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM", L"Arial", 0, 1252},
- {0x0cfcb9c1, L"AdobeThai", L"Kokila,Arial Narrow", 0, 847},
- {0x0e7de0f9, L"Playbill", L"Arial", 0, 1252},
- {0x0eff47c3, L"STHupo", L"Arial", 0, 936},
- {0x107ad374, L"Constantia", L"Arial", 2, 1252},
- {0x12194c2d, L"KunstlerScript", L"Arial", 8, 1252},
- {0x135ef6a1, L"MinionProSmBd",
- L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
- {0x158c4049, L"Garamond", L"Arial", 2, 1252},
- {0x160ecb24, L"STZhongsong", L"Arial", 0, 936},
- {0x161ed07e, L"MSGothic", L"Arial", 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular", L"Arial", 0, 1252},
- {0x18d1188f, L"Cambria", L"Arial", 2, 1252},
- {0x18eaf350, L"ArialUnicodeMS", L"Arial", 0, 936},
- {0x1a92d115, L"MingLiU", L"Arial", 1, 1252},
- {0x1cc217c6, L"TrebuchetMS", L"Arial", 0, 1252},
- {0x1d649596, L"BasemicTimes", L"Arial", 0, 1252},
- {0x1e34ee60, L"BellMT", L"Arial", 2, 1252},
- {0x1eb36945, L"CooperBlack", L"Arial", 2, 1252},
- {0x1ef7787d, L"BatangChe", L"Arial", 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT", L"Arial", 8, 1252},
- {0x220877aa, L"Candara", L"Arial", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular", L"Arial", 8, 1252},
- {0x251059c3, L"Chiller", L"Arial", 0, 1252},
- {0x25bed6dd, L"MSReferenceSansSerif", L"Arial", 0, 1252},
- {0x28154c81, L"Parchment-Regular", L"Arial", 8, 1252},
- {0x29711eb9, L"STLiti", L"Arial", 0, 936},
- {0x2b1993b4, L"Basemic", L"Arial", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg", L"Arial", 0, 1252},
- {0x2c147529, L"FootlightMTLight", L"Arial", 0, 1252},
- {0x2c198928, L"HarlowSolid", L"Arial", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright", L"Arial", 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"Arial", 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"Arial", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed", L"Arial", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR", L"Arial", 0, 1252},
- {0x3115525a, L"FangSong_GB2312", L"Arial", 0, 1252},
- {0x31327817, L"MyriadPro",
- L"Calibri,Corbel,Candara,Cambria Math,Franklin Gothic Medium,Arial "
- L"Narrow,Times New Roman",
- 0, 1252},
- {0x32244975, L"Helvetica", L"Arial", 0, 1252},
- {0x32ac995c, L"Terminal", L"Arial", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg", L"Arial", 0, 1252},
- {0x33bb65f2, L"Sylfaen", L"Arial", 2, 1252},
- {0x3402c30e, L"MSPMincho", L"Arial", 2, 1252},
- {0x3412bf31, L"SimSun-PUA", L"Arial", 0, 936},
- {0x36eb39b9, L"BerlinSansFB", L"Arial", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText", L"Arial", 2, 1252},
- {0x3a257d03, L"FangSong_GB2312", L"Arial", 0, 1252},
- {0x3cdae668, L"FreestyleScript", L"Arial", 8, 1252},
- {0x3d55aed7, L"Jokerman", L"Arial", 0, 1252},
- {0x3d5b4385, L"PMingLiU", L"Arial", 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa", L"Arial", 0, 1252},
- {0x3e532d74, L"FranklinGothicMedium", L"Arial", 0, 1252},
- {0x3e6aa32d, L"NSimSun", L"Arial", 1, 936},
- {0x3f6c36a8, L"Gautami", L"Arial", 0, 1252},
- {0x3ff32662, L"Chiller-Regular", L"Arial", 0, 1252},
- {0x409de312, L"ModernNo.20", L"Arial", 2, 1252},
- {0x41443c5e, L"Georgia", L"Arial", 2, 1252},
- {0x4160ade5, L"BellGothicStdBlack",
- L"Arial,Arial Unicode MS,Book Antiqua,Dotum,Georgia", 0, 1252},
- {0x421976c4, L"Modern-Regular", L"Arial", 2, 1252},
- {0x422a7252, L"Stencil", L"Arial", 0, 1252},
- {0x42c8554f, L"Fixedsys", L"Arial", 0, 1252},
- {0x435cb41d, L"Roman", L"Arial", 0, 1252},
- {0x47882383, L"CourierNew", L"Arial", 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi", L"Arial", 0, 1252},
- {0x480bf7a4, L"CourierStd", L"Courier New,Verdana", 0, 1252},
- {0x481ad6ed, L"VladimirScript", L"Arial", 8, 1252},
- {0x4911577a, L"YouYuan", L"Arial", 1, 936},
- {0x4a788d72, L"STXingkai", L"Arial", 0, 936},
- {0x4bf88566, L"SegoeCondensed", L"Arial", 0, 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg", L"Arial", 0, 1252},
- {0x4ea967ce, L"GulimChe", L"Arial", 1, 1252},
- {0x4f68bd79, L"LetterGothicStd", L"Courier New,Verdana", 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM", L"Arial", 0, 1252},
- {0x531b3dea, L"BasemicSymbol", L"Arial", 0, 1252},
- {0x5333fd39, L"CalifornianFB-Reg", L"Arial", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0", L"Arial", 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter", L"Arial", 0, 1252},
- {0x574d4d3d, L"AdobeArabic", L"Arial Narrow", 0, 1252},
- {0x5792e759, L"STKaiti", L"Arial", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Arial", 0, 1252},
- {0x594e2da4, L"Vrinda", L"Arial", 0, 1252},
- {0x59baa9a2, L"KaiTi_GB2312", L"Arial", 0, 1252},
- {0x5cfedf4f, L"BaskOldFace", L"Arial", 0, 1252},
- {0x5f97921c, L"AdobeMyungjoStdM",
- L"Batang,Bookman Old Style,Consolas,STZhongsong", 0, 936},
- {0x5fefbfad, L"Batang", L"Arial", 2, 1252},
- {0x605342b9, L"DotumChe", L"Arial", 1, 1252},
- {0x608c5f9a, L"KaiTi_GB2312", L"Arial", 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals", L"Arial", 0, 1252},
- {0x626608a9, L"MVBoli", L"Arial", 0, 1252},
- {0x630501a3, L"SmallFonts", L"Arial", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0", L"Arial", 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0", L"Arial", 0, 936},
- {0x673a9e5f, L"Tunga", L"Arial", 0, 1252},
- {0x691aa4ce, L"NiagaraSolid", L"Arial", 0, 1252},
- {0x696259b7, L"Corbel", L"Arial", 0, 1252},
- {0x696ee9be, L"STXihei", L"Arial", 0, 936},
- {0x6c59cf69, L"Dotum", L"Arial", 0, 1252},
- {0x707fa561, L"Gungsuh", L"Arial", 2, 1252},
- {0x71416bb2, L"ZWAdobeF", L"Arial", 0, 1252},
- {0x71b41801, L"Verdana", L"Arial", 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Arial", 0, 1252},
- {0x73f4d19f, L"NiagaraEngraved", L"Arial", 0, 1252},
- {0x74001694, L"MyriadProBlack", L"Book Antiqua,Constantia,Dotum,Georgia", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler", L"Arial", 0, 1252},
- {0x74cb44ee, L"NSimSun", L"Arial", 1, 936},
- {0x76b4d7ff, L"Shruti", L"Arial", 0, 1252},
- {0x788b3533, L"Webdings", L"Arial", 6, 42},
- {0x797dde99, L"MSSerif", L"Arial", 0, 1252},
- {0x7a0f9e9e, L"MSMincho", L"Arial", 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT", L"Arial", 0, 1252},
- {0x8213a433, L"LucidaSans-Typewriter", L"Arial", 0, 1252},
- {0x82fec929, L"AdobeSongStdL",
- L"Centaur,Calibri,STSong,Bell MT,Garamond,Times New Roman", 0, 936},
- {0x83581825, L"Modern", L"Arial", 0, 1252},
- {0x835a2823, L"Algerian", L"Arial", 0, 1252},
- {0x83dab9f5, L"Script", L"Arial", 0, 1252},
- {0x847b56da, L"Tahoma", L"Arial", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA", L"Arial", 0, 1252},
- {0x8b5cac0e, L"Onyx", L"Arial", 0, 1252},
- {0x8c6a499e, L"Gulim", L"Arial", 0, 1252},
- {0x8e0af790, L"JuiceITC", L"Arial", 0, 1252},
- {0x8e8d43b2, L"Centaur", L"Arial", 2, 1252},
- {0x8ee4dcca, L"BookshelfSymbol7", L"Arial", 0, 1252},
- {0x90794800, L"BellGothicStdLight", L"Bell MT,Calibri,Times New Roman", 0,
- 1252},
- {0x909b516a, L"Century", L"Arial", 2, 1252},
- {0x92ae370d, L"MSOutlook", L"Arial", 4, 42},
- {0x93c9fbf1, L"LucidaFax", L"Arial", 2, 1252},
- {0x9565085e, L"BookAntiqua", L"Arial", 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"Arial,Arial Unicode MS,Cambria,BatangChe",
- 0, 949},
- {0x9bbadd6b, L"ColonnaMT", L"Arial", 0, 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg", L"Arial", 0, 1252},
- {0x9d73008e, L"MSSansSerif", L"Arial", 0, 1252},
- {0xa0607db1, L"GungsuhChe", L"Arial", 1, 1252},
- {0xa0bcf6a1, L"LatinWide", L"Arial", 2, 1252},
- {0xa1429b36, L"Symbol", L"Arial", 6, 42},
- {0xa1fa5abc, L"Wingdings2", L"Arial", 6, 42},
- {0xa1fa5abd, L"Wingdings3", L"Arial", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular", L"Arial", 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"Arial", 0, 936},
- {0xa8d83ece, L"CalifornianFB", L"Arial", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic", L"Arial", 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic", L"Arial", 0, 1252},
- {0xade5337c, L"MSUIGothic", L"Arial", 0, 1252},
- {0xb08dd941, L"WideLatin", L"Arial", 2, 1252},
- {0xb207f05d, L"PoorRichard", L"Arial", 2, 1252},
- {0xb3bc492f, L"JuiceITC-Regular", L"Arial", 0, 1252},
- {0xb5545399, L"Marlett", L"Arial", 4, 42},
- {0xb5dd1ebb, L"BritannicBold", L"Arial", 0, 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic", L"Arial", 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Arial", 2, 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR", L"Batang,Century,Dotum", 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold", L"Arial", 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven", L"Arial", 0, 1252},
- {0xc16c0118, L"AdobeHebrew", L"Bell MT,Berlin Sans FB,Calibri", 0, 1252},
- {0xc318b0af, L"MyriadProLight", L"Calibri,STFangsong,Times New Roman", 0,
- 1252},
- {0xc65e5659, L"CambriaMath", L"Arial", 2, 1252},
- {0xc75c8f05, L"LucidaConsole", L"Arial", 1, 1252},
- {0xca7c35d6, L"Calibri", L"Arial", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei", L"Arial", 0, 936},
- {0xcb7190f9, L"Magneto-Bold", L"Arial", 0, 1252},
- {0xcca00cc5, L"System", L"Arial", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular", L"Arial", 0, 1252},
- {0xccc5818c, L"EuroSign", L"Arial", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic", L"Arial", 0, 1252},
- {0xcf7b8fdb, L"MinionPro",
- L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
- {0xcfe5755f, L"Simhei", L"Arial", 1, 936},
- {0xd011f4ee, L"MSPGothic", L"Arial", 0, 1252},
- {0xd060e7ef, L"Vivaldi", L"Arial", 8, 1252},
- {0xd07edec1, L"FranklinGothic-Medium", L"Arial", 0, 1252},
- {0xd107243f, L"SimSun", L"Arial", 0, 936},
- {0xd1881562, L"ArialNarrow", L"Arial Narrow", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed", L"Arial", 0, 1252},
- {0xd22bfa60, L"ComicSansMS", L"Arial", 8, 1252},
- {0xd3bd0e35, L"Bauhaus93", L"Arial", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"Arial", 0, 936},
- {0xd6679c12, L"BernardMTCondensed", L"Arial", 0, 1252},
- {0xd8e8a027, L"LucidaSans", L"Arial", 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg", L"Arial", 2, 1252},
- {0xda7e551e, L"STSong", L"Arial", 0, 936},
- {0xdaa6842d, L"STZhongsong", L"Arial", 0, 936},
- {0xdaaab93f, L"STFangsong", L"Arial", 0, 936},
- {0xdaeb0713, L"STSong", L"Arial", 0, 936},
- {0xdafedbef, L"STCaiyun", L"Arial", 0, 936},
- {0xdb00a3d9, L"Broadway", L"Arial", 0, 1252},
- {0xdb1f5ad4, L"STXinwei", L"Arial", 0, 936},
- {0xdb326e7f, L"STKaiti", L"Arial", 0, 936},
- {0xdb69595a, L"STHupo", L"Arial", 0, 936},
- {0xdba0082c, L"STXihei", L"Arial", 0, 936},
- {0xdbd0ab18, L"STXingkai", L"Arial", 0, 936},
- {0xdc1a7db1, L"STLiti", L"Arial", 0, 936},
- {0xdc33075f, L"KristenITC-Regular", L"Arial", 8, 1252},
- {0xdcc7009c, L"Harrington", L"Arial", 0, 1252},
- {0xdd712466, L"ArialBlack", L"Arial", 0, 1252},
- {0xdde87b3e, L"Impact", L"Arial", 0, 1252},
- {0xdf69fb32, L"SnapITC", L"Arial", 0, 1252},
- {0xdf8b25e8, L"CenturyGothic", L"Arial", 0, 1252},
- {0xe0f705c0, L"KristenITC", L"Arial", 8, 1252},
- {0xe1427573, L"Raavi", L"Arial", 0, 1252},
- {0xe2cea0cb, L"Magneto", L"Arial", 0, 1252},
- {0xe36a9e17, L"Ravie", L"Arial", 0, 1252},
- {0xe433f8e2, L"Parchment", L"Arial", 8, 1252},
- {0xe43dff4a, L"Wingdings", L"Arial", 4, 42},
- {0xe4e2c405, L"MTExtra", L"Arial", 6, 42},
- {0xe618cc35, L"InformalRoman", L"Arial", 8, 1252},
- {0xe6c27ffc, L"Mistral", L"Arial", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"Courier New", 0, 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty", L"Arial", 0, 1252},
- {0xe90fb013, L"TempusSansITC", L"Arial", 0, 1252},
- {0xec637b42, L"Consolas", L"Verdana", 1, 1252},
- {0xed3a683b, L"STXinwei", L"Arial", 0, 936},
- {0xef264cd1, L"LucidaHandwriting", L"Arial", 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace", L"Arial", 0, 1252},
- {0xf1028030, L"Mangal", L"Arial", 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic", L"Arial", 0, 1252},
- {0xf210f06a, L"ArialMT", L"Arial", 0, 1252},
- {0xf477f16a, L"Latha", L"Arial", 0, 1252},
- {0xf616f3dd, L"LiSu", L"Arial", 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei", L"Arial", 0, 936},
- {0xfcd19697, L"BookmanOldStyle", L"Arial", 0, 1252},
- {0xfe209a82, L"LucidaCalligraphy", L"Arial", 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular", L"Batang,Century,Dotum", 0, 936},
-};
-#elif _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE",
- 0, 936},
- {0x01e4f102, L"YouYuan",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE",
- 1, 936},
- {0x030549dc, L"LiSu",
- L"WenQuanYi Zen Hei,WenQuanYi Zen Hei Sharp,WenQuanYi Zen Hei "
- L"Mono,WenQuanYi Micro Hei",
- 1, 936},
- {0x032edd44, L"Simhei",
- L"WenQuanYi Zen Hei,WenQuanYi Zen Hei Sharp,WenQuanYi Zen Hei "
- L"Mono,WenQuanYi Micro Hei",
- 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular", L"Droid Sans Japanese,FreeSerif", 2,
- 1252},
- {0x03ed90e6, L"Nina", L"FreeSerif", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain",
- L"Tibetan Machine Uni,LKLUG,Samyak Gujarati,Droid Sans Thai,Droid Sans "
- L"Armenian,Untitled1,utkal,Lohit Oriya",
- 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif",
- L"Droid Sans Japanese,FreeSerif,WenQuanYi Micro Hei", 0, 1252},
- {0x089b18a9, L"Arial",
- L"Droid Sans Japanese,DejaVu Sans Condensed,FreeSerif,WenQuanYi Micro Hei",
- 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva", L"Droid Sans Japanese,FreeSerif", 8, 1252},
- {0x0bb003e7, L"Kartika",
- L"FreeSans,Liberation Sans,Liberation Sans Narrow,Nimbus Sans "
- L"L,Garuda,FreeSerif,WenQuanYi Micro Hei",
- 2, 1252},
- {0x0bb469df, L"VinerHandITC",
- L"Droid Sans Japanese,Ubuntu,Liberation Sans,Liberation Serif", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM", L"FreeSerif", 0, 1252},
- {0x0cfcb9c1, L"AdobeThai", L"Droid Sans Japanese,Waree", 0, 847},
- {0x0e7de0f9, L"Playbill",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Ethiopic,Droid Sans Japanese,FreeSerif",
- 0, 1252},
- {0x0eff47c3, L"STHupo", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0x107ad374, L"Constantia",
- L"Droid Sans Japanese,FreeSerif,WenQuanYi Micro Hei,Ubuntu", 2, 1252},
- {0x12194c2d, L"KunstlerScript", L"Droid Sans Japanese,Liberation Serif", 8,
- 1252},
- {0x135ef6a1, L"MinionProSmBd", L"Liberation Serif", 0, 1252},
- {0x158c4049, L"Garamond",
- L"Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 2, 1252},
- {0x160ecb24, L"STZhongsong",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x161ed07e, L"MSGothic",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,AR PL "
- L"UMing CN,AR PL UMing HK,AR PL UMing TW",
- 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular",
- L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans L,DejaVu Sans", 0,
- 1252},
- {0x18d1188f, L"Cambria", L"Droid Sans Japanese,FreeSerif,FreeMono", 2,
- 1252},
- {0x18eaf350, L"ArialUnicodeMS",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x1a92d115, L"MingLiU",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 1252},
- {0x1cc217c6, L"TrebuchetMS",
- L"Droid Sans Japanese,Liberation Serif,FreeSerif,Ubuntu", 0, 1252},
- {0x1d649596, L"BasemicTimes",
- L"Liberation Serif,Times New Roman,Droid Sans Japanese,FreeSerif,Ubuntu",
- 0, 1252},
- {0x1e34ee60, L"BellMT",
- L"KacstQurn,Droid Sans Japanese,Ubuntu,Liberation Serif", 2, 1252},
- {0x1eb36945, L"CooperBlack",
- L"KacstQurn,Droid Sans Japanese,FreeMono,Liberation Mono, WenQuanYi Micro "
- L"Hei Mono",
- 2, 1252},
- {0x1ef7787d, L"BatangChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing "
- L"TW,WenQuanYi Zen Hei,WenQuanYi Micro Hei",
- 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
- L"Japanese,URW Chancery L,Liberation Sans",
- 8, 1252},
- {0x220877aa, L"Candara", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans", 8, 1252},
- {0x251059c3, L"Chiller",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
- L"Japanese,Liberation Sans",
- 0, 1252},
- {0x25bed6dd, L"MSReferenceSansSerif",
- L"DejaVu Sans Condensed,Ubuntu Condensed,Droid Sans Japanese,AR PL UKai "
- L"HK",
- 0, 1252},
- {0x28154c81, L"Parchment-Regular", L"Droid Sans Japanese,Liberation Sans",
- 8, 1252},
- {0x29711eb9, L"STLiti", L"AR PL UKai HK", 0, 936},
- {0x2b1993b4, L"Basemic",
- L"Liberation Serif,Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg", L"Droid Sans Japanese,Liberation Sans", 0,
- 1252},
- {0x2c147529, L"FootlightMTLight",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x2c198928, L"HarlowSolid",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,Liberation Sans",
- 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"DejaVu Sans", 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"AR PL UKai HK", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed",
- L"KacstQurn,Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR", L"DejaVu Serif", 0, 1252},
- {0x3115525a, L"FangSong_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x31327817, L"MyriadPro",
- L"Ubuntu Condensed,Droid Sans Japanese, FreeSerif", 0, 1252},
- {0x32244975, L"Helvetica",
- L"Ubuntu,DejaVu Sans Condensed,Liberation Sans,Liberation Sans "
- L"Narrow,Nimbus Sans L",
- 0, 1252},
- {0x32ac995c, L"Terminal", L"DejaVu Serif", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg", L"Droid Sans Japanese,DejaVu Serif", 0,
- 1252},
- {0x33bb65f2, L"Sylfaen", L"Droid Sans Japanese,DejaVu Sans", 2, 1252},
- {0x3402c30e, L"MSPMincho",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 2,
- 1252},
- {0x3412bf31, L"SimSun-PUA",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing CN,AR PL UMing HK", 0,
- 936},
- {0x36eb39b9, L"BerlinSansFB",
- L"Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText", L"Droid Sans Japanese,DejaVu Serif", 2,
- 1252},
- {0x3a257d03, L"FangSong_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei", 0, 1252},
- {0x3c7d1d07, L"Garamond3LTStd",
- L"Droid Sans Japanese,Ubuntu Condensed,DejaVu Sans Condensed,Liberation "
- L"Serif,Ubuntu,FreeSerif",
- 2, 1252},
- {0x3cdae668, L"FreestyleScript",
- L"KacstQurn,Droid Sans Japanese,DejaVu Sans", 8, 1252},
- {0x3d55aed7, L"Jokerman", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x3d5b4385, L"PMingLiU",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa", L"Droid Sans Japanese,DejaVu Sans", 0,
- 1252},
- {0x3e532d74, L"FranklinGothicMedium", L"Droid Sans Japanese,Ubuntu", 0,
- 1252},
- {0x3e6aa32d, L"NSimSun",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 936},
- {0x3f6c36a8, L"Gautami",
- L"Droid Arabic Naskh,Droid Sans Ethiopic, mry_KacstQurn,Droid Sans "
- L"Japanese,FreeSans",
- 0, 1252},
- {0x3ff32662, L"Chiller-Regular",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,FreeSans", 0, 1252},
- {0x409de312, L"ModernNo.20",
- L"KacstQurn,Droid Sans Japanese,Nimbus Sans L,Nimbus Sans L,FreeSans", 2,
- 1252},
- {0x41443c5e, L"Georgia", L"Droid Sans Japanese,FreeSans", 2, 1252},
- {0x4160ade5, L"BellGothicStdBlack", L"FreeSans", 0, 1252},
- {0x421976c4, L"Modern-Regular", L"FreeSans", 2, 1252},
- {0x422a7252, L"Stencil", L"Droid Sans Japanese,FreeSans,Liberation Sans", 0,
- 1252},
- {0x42c8554f, L"Fixedsys", L"FreeSerif", 0, 1252},
- {0x435cb41d, L"Roman", L"FreeSerif", 0, 1252},
- {0x47882383, L"CourierNew",
- L"FreeMono,WenQuanYi Micro Hei Mono,AR PL UKai CN,AR PL UKai HK,AR PL "
- L"UKai TW,AR PL UKai TW MBE,DejaVu Sans",
- 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi", L"Droid Sans Japanese,Liberation Serif",
- 0, 1252},
- {0x480bf7a4, L"CourierStd", L"DejaVu Sans", 0, 1252},
- {0x481ad6ed, L"VladimirScript", L"Droid Sans Japanese,DejaVu Serif", 8,
- 1252},
- {0x4911577a, L"YouYuan",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 1,
- 936},
- {0x4a788d72, L"STXingkai", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0x4bf88566, L"SegoeCondensed", L"FreeSerif", 0, 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg", L"Droid Sans Japanese,Liberation Serif",
- 0, 1252},
- {0x4ea967ce, L"GulimChe",
- L"WenQuanYi Zen Hei Mono,AR PL UKai CN,AR PL UKai HK,AR PL UKai TW,AR PL "
- L"UKai TW MBE",
- 1, 1252},
- {0x4f68bd79, L"LetterGothicStd",
- L"FreeMono,Liberation Mono,Andale Mono,WenQuanYi Micro Hei Mono", 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM", L"FreeSerif", 0, 1252},
- {0x531b3dea, L"BasemicSymbol", L"FreeSerif", 0, 1252},
- {0x5333fd39, L"CalifornianFB-Reg",
- L"Droid Sans Japanese,URW Chancery L,FreeSerif", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter",
- L"Ubuntu Mono,DejaVu Sans Mono,Nimbus Mono L,Liberation Mono,Courier 10 "
- L"Pitch,FreeMono",
- 0, 1252},
- {0x574d4d3d, L"AdobeArabic", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x5792e759, L"STKaiti", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Droid Sans Japanese,DejaVu Sans", 0,
- 1252},
- {0x594e2da4, L"Vrinda",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Arabic "
- L"Naskh,mry_KacstQurn,Droid Sans Japanese,FreeSans,FreeSerif",
- 0, 1252},
- {0x59baa9a2, L"KaiTi_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x5cfedf4f, L"BaskOldFace",
- L"KacstQurn,Droid Sans Japanese,Ubuntu,Liberation Serif", 0, 1252},
- {0x5e16ac91, L"TrajanPro",
- L"Nimbus Sans L,AR PL UMing HK,AR PL UKai HK,AR PL UMing TW,AR PL UMing "
- L"TW MBE,DejaVu Sans,DejaVu Serif",
- 0, 1252},
- {0x5f388196, L"ITCLegacySansStdMedium",
- L"Liberation Serif,FreeSerif,FreeSans,Ubuntu", 0, 1252},
- {0x5f97921c, L"AdobeMyungjoStdM",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x5fefbfad, L"Batang",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 2, 1252},
- {0x605342b9, L"DotumChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 1,
- 1252},
- {0x608c5f9a, L"KaiTi_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,DejaVu Serif,DejaVu Sans",
- 0, 1252},
- {0x626608a9, L"MVBoli",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Ethiopic,Droid Sans Japanese,DejaVu Sans",
- 0, 1252},
- {0x630501a3, L"SmallFonts", L"DejaVu Serif", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0",
- L"AR PL UMing CN,AR PL UKai CN, AR PL UMing HK", 0, 936},
- {0x673a9e5f, L"Tunga",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,DejaVu Serif",
- 0, 1252},
- {0x691aa4ce, L"NiagaraSolid", L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0x696259b7, L"Corbel", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x696ee9be, L"STXihei", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0x6c59cf69, L"Dotum", L"WenQuanYi Zen Hei Mono", 0, 1252},
- {0x707fa561, L"Gungsuh", L"WenQuanYi Zen Hei Mono", 2, 1252},
- {0x71416bb2, L"ZWAdobeF",
- L"KacstArt,KacstBookm,KacstDecorative,KacstDigital,KacstFarsi,KacstLetter,"
- L"KacstOffice,Dingbats,FreeSerif",
- 0, 1252},
- {0x71b41801, L"Verdana",
- L"DejaVu Sans Condensed,Ubuntu Condensed,Droid Sans Japanese,DejaVu Sans",
- 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Droid Sans Japanese,FreeSerif", 0,
- 1252},
- {0x73f4d19f, L"NiagaraEngraved", L"Droid Sans Japanese,FreeSerif", 0, 1252},
- {0x74001694, L"MyriadProBlack", L"Droid Sans Japanese,AR PL UKai HK", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler", L"Droid Sans Japanese,DejaVu Serif", 0,
- 1252},
- {0x74cb44ee, L"NSimSun", L"WenQuanYi Zen Hei Mono", 1, 936},
- {0x76b4d7ff, L"Shruti",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,FreeSans",
- 0, 1252},
- {0x788b3533, L"Webdings", L"FreeSans", 6, 42},
- {0x797dde99, L"MSSerif", L"FreeSans", 0, 1252},
- {0x7a0f9e9e, L"MSMincho",
- L"WenQuanYi Micro Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW",
- 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT",
- L"Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
- {0x8213a433, L"LucidaSans-Typewriter",
- L"Ubuntu Mono,Liberation Mono,DejaVu Sans Mono", 0, 1252},
- {0x82fec929, L"AdobeSongStdL",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x83581825, L"Modern", L"FreeSans", 0, 1252},
- {0x835a2823, L"Algerian",
- L"KacstQurn,Droid Sans Japanese,FreeSans,Liberation Sans,Ubuntu", 0, 1252},
- {0x83dab9f5, L"Script", L"FreeSans", 0, 1252},
- {0x847b56da, L"Tahoma",
- L"Droid Sans Japanese,DejaVu Sans Condensed,FreeSerif", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x8b5cac0e, L"Onyx", L"Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x8c6a499e, L"Gulim",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x8e0af790, L"JuiceITC", L"Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x8e8d43b2, L"Centaur",
- L"KacstQurn,Droid Sans Japanese,Khmer OS,Khmer OS System", 2, 1252},
- {0x8ee4dcca, L"BookshelfSymbol7", L"Liberation Sans", 0, 1252},
- {0x90794800, L"BellGothicStdLight", L"Liberation Sans", 0, 1252},
- {0x909b516a, L"Century",
- L"Droid Sans Japanese,Liberation Sans,Liberation Mono,Liberation Serif", 2,
- 1252},
- {0x92ae370d, L"MSOutlook", L"Liberation Sans", 4, 42},
- {0x93c9fbf1, L"LucidaFax",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,mry_KacstQurn,Liberation Sans",
- 2, 1252},
- {0x9565085e, L"BookAntiqua",
- L"Droid Sans Japanese,Liberation Sans,Liberation Serif", 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"AR PL UMing HK", 0, 949},
- {0x9bbadd6b, L"ColonnaMT",
- L"KacstQurn,Droid Sans Japanese,Khmer OS,Khmer OS System", 0, 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg",
- L"Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
- {0x9d73008e, L"MSSansSerif", L"FreeSerif", 0, 1252},
- {0xa0607db1, L"GungsuhChe",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 1252},
- {0xa0bcf6a1, L"LatinWide", L"FreeSerif", 2, 1252},
- {0xa1429b36, L"Symbol", L"FreeSerif", 6, 42},
- {0xa1fa5abc, L"Wingdings2", L"FreeSerif", 6, 42},
- {0xa1fa5abd, L"Wingdings3", L"FreeSerif", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,FreeSerif",
- 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"AR PL UMing CN", 0, 936},
- {0xa8d83ece, L"CalifornianFB", L"Droid Sans Japanese,FreeSerif", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic",
- L"Tibetan Machine Uni,LKLUG,Samyak Gujarati,Droid Sans "
- L"Thai,utkal,Kedage,Mallige,AR PL UKai CN",
- 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic",
- L"KacstQurn,Droid Sans Japanese,Liberation Serif", 0, 1252},
- {0xade5337c, L"MSUIGothic",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0xb08dd941, L"WideLatin",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,Liberation Serif",
- 2, 1252},
- {0xb12765e0, L"ITCLegacySansStdBook",
- L"AR PL UMing HK,AR PL UKai HK,FreeSerif,Ubuntu,FreeSans", 0, 1252},
- {0xb207f05d, L"PoorRichard", L"Droid Sans Japanese,Liberation Serif", 2,
- 1252},
- {0xb3bc492f, L"JuiceITC-Regular", L"Droid Sans Japanese,Liberation Serif",
- 0, 1252},
- {0xb5545399, L"Marlett", L"Liberation Serif", 4, 42},
- {0xb5dd1ebb, L"BritannicBold",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,mry_KacstQurn,Liberation Serif",
- 0, 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,DejaVu Serif",
- 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Droid Sans Japanese,Liberation Sans", 2,
- 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold", L"Droid Sans Japanese,DejaVu Serif",
- 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven", L"DejaVu Sans", 0, 1252},
- {0xc16c0118, L"AdobeHebrew", L"Droid Sans Japanese,Ubuntu,Liberation Serif",
- 0, 1252},
- {0xc318b0af, L"MyriadProLight",
- L"Droid Sans Japanese,AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 1252},
- {0xc65e5659, L"CambriaMath", L"Droid Sans Japanese,FreeSerif,FreeMono", 2,
- 1252},
- {0xc75c8f05, L"LucidaConsole",
- L"Liberation Mono,DejaVu Sans Mono,FreeMono,WenQuanYi Micro Hei Mono", 1,
- 1252},
- {0xca7c35d6, L"Calibri", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xcb7190f9, L"Magneto-Bold",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,DejaVu Serif",
- 0, 1252},
- {0xcca00cc5, L"System", L"DejaVu Sans", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular", L"Droid Sans Japanese,DejaVu Sans", 0,
- 1252},
- {0xccc5818c, L"EuroSign", L"DejaVu Serif", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic",
- L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans L,DejaVu Serif", 0,
- 1252},
- {0xcf7b8fdb, L"MinionPro", L"DejaVu Sans", 0, 1252},
- {0xcfe5755f, L"Simhei",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 936},
- {0xd011f4ee, L"MSPGothic",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 0,
- 1252},
- {0xd060e7ef, L"Vivaldi",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans,Ubuntu", 8, 1252},
- {0xd07edec1, L"FranklinGothic-Medium", L"Droid Sans Japanese,Ubuntu", 0,
- 1252},
- {0xd107243f, L"SimSun", L"WenQuanYi Zen Hei Mono", 0, 936},
- {0xd1881562, L"ArialNarrow",
- L"Liberation Sans Narrow,Droid Sans Japanese,FreeSerif", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed",
- L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0xd22bfa60, L"ComicSansMS",
- L"Droid Sans Japanese,FreeMono,Liberation Mono", 8, 1252},
- {0xd3bd0e35, L"Bauhaus93",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0xd6679c12, L"BernardMTCondensed",
- L"KacstQurn,Droid Sans Japanese,Nimbus Sans L,URW Chancery "
- L"L,KacstOne,Liberation Sans",
- 0, 1252},
- {0xd8e8a027, L"LucidaSans",
- L"Liberation Sans Narrow,Nimbus Sans L,KacstQurn,Droid Arabic Naskh,Droid "
- L"Sans Ethiopic,DejaVu Serif Condensed,Liberation Mono,Ubuntu",
- 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg",
- L"Droid Sans Japanese,Ubuntu,Liberation Serif", 2, 1252},
- {0xda7e551e, L"STSong", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0xdaa6842d, L"STZhongsong",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xdaaab93f, L"STFangsong",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdaeb0713, L"STSong",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdafedbef, L"STCaiyun", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdb00a3d9, L"Broadway",
- L"KacstQurn,Droid Sans Japanese,DejaVu Sans,FreeMono,Liberation Mono", 0,
- 1252},
- {0xdb1f5ad4, L"STXinwei", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdb326e7f, L"STKaiti",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdb69595a, L"STHupo",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdba0082c, L"STXihei",
- L" WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdbd0ab18, L"STXingkai", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdc1a7db1, L"STLiti", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdc33075f, L"KristenITC-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu Sans "
- L"Condensed,Ubuntu,Liberation Sans",
- 8, 1252},
- {0xdcc7009c, L"Harrington",
- L"KacstQurn,Droid Sans Japanese,Liberation Serif,FreeSerif,Ubuntu", 0,
- 1252},
- {0xdd712466, L"ArialBlack",
- L"Droid Sans Japanese,DejaVu Sans,DejaVu Serif,FreeMono", 0, 1252},
- {0xdde87b3e, L"Impact", L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0xdf69fb32, L"SnapITC",
- L"Liberation Sans Narrow,Ubuntu Condensed,DejaVu Sans,DejaVu "
- L"Serif,FreeMono",
- 0, 1252},
- {0xdf8b25e8, L"CenturyGothic",
- L"Droid Sans Japanese,Liberation Mono,Liberation Sans,Liberation Serif", 0,
- 1252},
- {0xe0f705c0, L"KristenITC",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu Sans "
- L"Condensed,Ubuntu,Liberation Sans",
- 8, 1252},
- {0xe1427573, L"Raavi",
- L"Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,mry_KacstQurn,FreeSerif,Liberation Serif,Khmer OS",
- 0, 1252},
- {0xe2cea0cb, L"Magneto",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu "
- L"Serif,DejaVu Serif Condensed,DejaVu Sans",
- 0, 1252},
- {0xe36a9e17, L"Ravie",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu "
- L"Serif,DejaVu Sans,FreeMono",
- 0, 1252},
- {0xe433f8e2, L"Parchment", L"Droid Sans Japanese,DejaVu Serif", 8, 1252},
- {0xe43dff4a, L"Wingdings", L"DejaVu Serif", 4, 42},
- {0xe4e2c405, L"MTExtra", L"DejaVu Serif", 6, 42},
- {0xe618cc35, L"InformalRoman",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,Nimbus Sans L,DejaVu Sans Condensed,Ubuntu,Liberation Sans",
- 8, 1252},
- {0xe6c27ffc, L"Mistral", L"Droid Sans Japanese,DejaVu Serif", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"DejaVu Sans,DejaVu Sans Condensed,FreeSerif", 0,
- 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty", L"DejaVu Serif", 0, 1252},
- {0xe90fb013, L"TempusSansITC",
- L"Droid Sans Japanese,Ubuntu,Liberation Serif,FreeSerif", 0, 1252},
- {0xec637b42, L"Consolas",
- L"DejaVu Sans Condensed,AR PL UKai CN,AR PL UKai HK,AR PL UKai "
- L"TW,FreeSerif,FreeSans",
- 1, 1252},
- {0xed3a683b, L"STXinwei", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xef264cd1, L"LucidaHandwriting",
- L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans "
- L"L,KacstQurn,Liberation Mono",
- 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace",
- L"KacstQurn,Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 0,
- 1252},
- {0xf1028030, L"Mangal",
- L"FreeSans,TSCu_Paranar,Garuda,Liberation Sans,Liberation Sans "
- L"Narrow,Nimbus Sans L",
- 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic",
- L"Droid Sans Japanese,DejaVu Serif Condensed,DejaVu Sans "
- L"Condensed,Liberation Sans,Ubuntu",
- 0, 1252},
- {0xf210f06a, L"ArialMT",
- L"Liberation Sans,Liberation Sans Narrow,FreeSans,Nimbus Sans L,Khmer OS "
- L"System,Khmer OS",
- 0, 1252},
- {0xf477f16a, L"Latha",
- L"Liberation Sans Narrow,Nimbus Sans L,Droid Arabic "
- L"Naskh,mry_KacstQurn,FreeSerif,Nimbus Sans L",
- 0, 1252},
- {0xf616f3dd, L"LiSu",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE",
- 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xfcd19697, L"BookmanOldStyle",
- L"Droid Sans Japanese,Liberation Mono,Liberation Sans,Liberation Serif", 0,
- 1252},
- {0xfe209a82, L"LucidaCalligraphy",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,DejaVu Serif,DejaVu Sans,FreeMono",
- 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
-};
-#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0x01e4f102, L"YouYuan", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x030549dc, L"LiSu", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x032edd44, L"Simhei", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular",
- L"Noteworthy,Avenir Next Condensed,Impact", 2, 1252},
- {0x03ed90e6, L"Nina", L"Microsoft Sans Serif", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain",
- L"LastResort,Apple "
- L"Chancery,STIXVariants,STIXSizeOneSym,STIXSizeOneSym,Apple Braille",
- 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif", L"Songti SC,Apple Symbols", 0, 1252},
- {0x089b18a9, L"Arial",
- L"Arial Unicode MS,Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva", L"Arial Narrow,Impact", 8, 1252},
- {0x0bb003e7, L"Kartika",
- L"Arial Unicode MS,Microsoft Sans Serif,Arial Narrow,Damascus", 2, 1252},
- {0x0bb469df, L"VinerHandITC", L"Comic Sans MS,Songti SC,STSong", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Apple Symbols", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x0cfcb9c1, L"AdobeThai", L"Avenir Next Condensed Ultra Light", 0, 847},
- {0x0e7de0f9, L"Playbill", L"STIXNonUnicode", 0, 1252},
- {0x0eff47c3, L"STHupo", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0x107ad374, L"Constantia", L"Arial Unicode MS,Palatino,Baskerville", 2,
- 1252},
- {0x12194c2d, L"KunstlerScript",
- L"Avenir Next Condensed Demi Bold,Arial Narrow", 8, 1252},
- {0x135ef6a1, L"MinionProSmBd", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x158c4049, L"Garamond", L"Impact,Arial Narrow", 2, 1252},
- {0x160ecb24, L"STZhongsong", L"STFangsong,Songti SC", 0, 936},
- {0x161ed07e, L"MSGothic",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing "
- L"TW,Microsoft Sans Serif,Apple Symbols",
- 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular", L"STHeiti,Arial Black", 0, 1252},
- {0x18d1188f, L"Cambria", L"Arial Unicode MS", 2, 1252},
- {0x18eaf350, L"ArialUnicodeMS", L"Microsoft Sans Serif,Apple Symbols", 0,
- 936},
- {0x1a92d115, L"MingLiU", L"Heiti SC,STHeiti", 1, 1252},
- {0x1cc217c6, L"TrebuchetMS", L"Damascus,Impact,Arial Narrow", 0, 1252},
- {0x1d649596, L"BasemicTimes", L"Liberation Serif,Impact,Arial Narrow", 0,
- 1252},
- {0x1e34ee60, L"BellMT",
- L"Papyrus,STIXNonUnicode,Microsoft Sans Serif,Avenir Light", 2, 1252},
- {0x1eb36945, L"CooperBlack",
- L"Marion,STIXNonUnicode,Arial Rounded MT Bold,Lucida Grande", 2, 1252},
- {0x1ef7787d, L"BatangChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE,Arial Unicode MS,Heiti TC",
- 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT",
- L"STIXNonUnicode,Damascus,Arial Narrow,Avenir Next Condensed,Cochin", 8,
- 1252},
- {0x220877aa, L"Candara", L"Cochin,Baskerville,Marion", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular",
- L"STIXNonUnicode,Nadeem,Zapf Dingbats", 8, 1252},
- {0x251059c3, L"Chiller",
- L"Zapf Dingbats,Damascus,STIXNonUnicode,Papyrus,KufiStandardGK,Baghdad", 0,
- 1252},
- {0x25bed6dd, L"MSReferenceSansSerif",
- L"Tahoma,Apple Symbols,Apple LiGothic,Arial Unicode MS,Lucida "
- L"Grande,Microsoft Sans Serif",
- 0, 1252},
- {0x28154c81, L"Parchment-Regular", L"Microsoft Sans Serif,Apple Symbols", 8,
- 1252},
- {0x29711eb9, L"STLiti", L"Kaiti SC,Songti SC", 0, 936},
- {0x2b1993b4, L"Basemic", L"Impact,Arial Narrow", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x2c147529, L"FootlightMTLight",
- L"STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans,Noteworthy", 0, 1252},
- {0x2c198928, L"HarlowSolid",
- L"Avenir Medium,Avenir Next Medium,Arial Unicode MS", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright",
- L"PT Sans Narrow,Papyrus,Damascus,STIXNonUnicode,Arial Rounded MT "
- L"Bold,Comic Sans MS,Avenir Next",
- 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"Kaiti SC,Songti SC", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed",
- L"Impact,Avenir Next Condensed Demi Bold,American Typewriter", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x3115525a, L"FangSong_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
- {0x31327817, L"MyriadPro", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x32244975, L"Helvetica",
- L"Arial Narrow,Arial Unicode MS,Damascus,STIXNonUnicode", 0, 1252},
- {0x32ac995c, L"Terminal", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x33bb65f2, L"Sylfaen", L"Arial Unicode MS,Marion", 2, 1252},
- {0x3402c30e, L"MSPMincho", L"Arial Unicode MS,Apple SD Gothic Neo", 2,
- 1252},
- {0x3412bf31, L"SimSun-PUA", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0x36eb39b9, L"BerlinSansFB", L"American Typewriter,Impact", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText", L"STIXGeneral,.Helvetica Neue Desk UI", 2,
- 1252},
- {0x3a257d03, L"FangSong_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
- {0x3cdae668, L"FreestyleScript", L"Nadeem,Zapf Dingbats,STIXNonUnicode", 8,
- 1252},
- {0x3d55aed7, L"Jokerman",
- L"Papyrus,Lucida Grande,Heiti TC,American Typewriter", 0, 1252},
- {0x3d5b4385, L"PMingLiU", L"Heiti SC,STHeiti", 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa", L"American Typewriter,Marion", 0, 1252},
- {0x3e532d74, L"FranklinGothicMedium", L"Impact,Arial Narrow", 0, 1252},
- {0x3e6aa32d, L"NSimSun", L"STHeiti,STFangsong", 1, 936},
- {0x3f6c36a8, L"Gautami",
- L"Damascus,STIXNonUnicode,STIXGeneral,American Typewriter", 0, 1252},
- {0x3ff32662, L"Chiller-Regular", L"Papyrus,KufiStandardGK,Baghdad", 0,
- 1252},
- {0x409de312, L"ModernNo.20", L"Avenir Next Condensed,Impact", 2, 1252},
- {0x41443c5e, L"Georgia", L".Helvetica Neue Desk UI,Arial Unicode MS", 2,
- 1252},
- {0x4160ade5, L"BellGothicStdBlack", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x421976c4, L"Modern-Regular", L"Impact", 2, 1252},
- {0x422a7252, L"Stencil", L"STIXNonUnicode,Songti SC,Georgia,Baskerville", 0,
- 1252},
- {0x42c8554f, L"Fixedsys", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x435cb41d, L"Roman", L"Arial Narrow", 0, 1252},
- {0x47882383, L"CourierNew", L"PCMyungjo,Osaka,Arial Unicode MS,Songti SC",
- 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi",
- L"STIXNonUnicode,American Typewriter,Avenir Next Condensed Heavy", 0,
- 1252},
- {0x480bf7a4, L"CourierStd", L"Courier New", 0, 1252},
- {0x481ad6ed, L"VladimirScript",
- L"STIXNonUnicode,Avenir Next Condensed,Impact", 8, 1252},
- {0x4911577a, L"YouYuan", L"STHeiti,Heiti TC", 1, 936},
- {0x4a788d72, L"STXingkai", L"Kaiti SC,Songti SC", 0, 936},
- {0x4bf88566, L"SegoeCondensed", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg",
- L"STIXNonUnicode,American Typewriter,Impact", 0, 1252},
- {0x4ea967ce, L"GulimChe", L"Arial Unicode MS,Heiti TC,STFangsong", 1, 1252},
- {0x4f68bd79, L"LetterGothicStd",
- L"Courier New,Andale Mono,Ayuthaya,PCMyungjo,Osaka", 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x531b3dea, L"BasemicSymbol", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x5333fd39, L"CalifornianFB-Reg",
- L"American Typewriter,Avenir Next Condensed,Impact", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0", L"STFangsong,Songti SC,STSong", 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter", L"Menlo,Courier New,Andale Mono", 0,
- 1252},
- {0x574d4d3d, L"AdobeArabic", L"Arial Narrow", 0, 1252},
- {0x5792e759, L"STKaiti", L"Songti SC,Arial Unicode MS", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Lucida Grande,Arial Unicode MS,Menlo",
- 0, 1252},
- {0x594e2da4, L"Vrinda", L"Geeza Pro,Damascus,STIXGeneral,Gill Sans", 0,
- 1252},
- {0x59baa9a2, L"KaiTi_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
- {0x5cfedf4f, L"BaskOldFace",
- L"Avenir Next Condensed Heavy,PT Sans,Avenir Next Condensed", 0, 1252},
- {0x5e16ac91, L"TrajanPro", L"Arial Narrow,PT Sans Narrow,Damascus", 0,
- 1252},
- {0x5f97921c, L"AdobeMyungjoStdM",
- L"AppleMyungjo,AppleGothic,Arial Unicode MS", 0, 936},
- {0x5fefbfad, L"Batang", L"Arial Unicode MS,Songti SC", 2, 1252},
- {0x605342b9, L"DotumChe", L"Arial Unicode MS,Heiti TC", 1, 1252},
- {0x608c5f9a, L"KaiTi_GB2312", L"Hiragino Sans GB,STHeiti,Heiti TC", 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals",
- L"Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black,Avenir Next Heavy",
- 0, 1252},
- {0x626608a9, L"MVBoli",
- L"Apple Braille,Geeza Pro,Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x630501a3, L"SmallFonts", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0", L"STFangsong,Songti SC,STSong", 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0", L"STHeiti,Heiti TC", 0, 936},
- {0x673a9e5f, L"Tunga",
- L"Damascus,STIXNonUnicode,Avenir Next Condensed,Avenir Next Condensed "
- L"Ultra Light,Futura",
- 0, 1252},
- {0x691aa4ce, L"NiagaraSolid", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x696259b7, L"Corbel", L"Cochin,Baskerville,Marion", 0, 1252},
- {0x696ee9be, L"STXihei", L"STHeiti,Heiti TC,Songti SC,Arial Unicode MS", 0,
- 936},
- {0x6c59cf69, L"Dotum", L"Arial Unicode MS,Songti SC", 0, 1252},
- {0x707fa561, L"Gungsuh", L"Arial Unicode MS,Heiti TC", 2, 1252},
- {0x71416bb2, L"ZWAdobeF",
- L"STIXSizeFourSym,STIXSizeThreeSym,STIXSizeTwoSym,STIXSizeOneSym", 0,
- 1252},
- {0x71b41801, L"Verdana",
- L"Tahoma,Marion,Apple Symbols,.Helvetica Neue Desk UI,Lucida "
- L"Grande,Courier New",
- 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Palatino,Arial Unicode MS", 0, 1252},
- {0x73f4d19f, L"NiagaraEngraved", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x74001694, L"MyriadProBlack", L"Palatino,Baskerville,Marion,Cochin", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x74cb44ee, L"NSimSun", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x76b4d7ff, L"Shruti",
- L"Damascus,STIXNonUnicode,Arial Unicode MS,American Typewriter", 0, 1252},
- {0x788b3533, L"Webdings", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0x797dde99, L"MSSerif", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x7a0f9e9e, L"MSMincho",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE,Arial Unicode MS,Apple SD Gothic Neo",
- 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT",
- L"STIXNonUnicode,Arial Unicode MS,Baskerville,Avenir Next Medium", 0,
- 1252},
- {0x8213a433, L"LucidaSans-Typewriter",
- L"Comic Sans MS,Avenir Next,Arial Rounded MT Bold", 0, 1252},
- {0x82fec929, L"AdobeSongStdL", L"Heiti TC,STHeiti", 0, 936},
- {0x83581825, L"Modern", L"Avenir Next Condensed,Impact", 0, 1252},
- {0x835a2823, L"Algerian",
- L"STIXNonUnicode,Baskerville,Avenir Next Medium,American Typewriter", 0,
- 1252},
- {0x83dab9f5, L"Script", L"Arial Narrow", 0, 1252},
- {0x847b56da, L"Tahoma", L"Songti SC,Apple Symbols", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA", L"STHeiti,Heiti TC,STFangsong", 0, 1252},
- {0x8b5cac0e, L"Onyx", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x8c6a499e, L"Gulim", L"Arial Unicode MS,Songti SC", 0, 1252},
- {0x8e0af790, L"JuiceITC", L"Nadeem,Al Bayan", 0, 1252},
- {0x8e8d43b2, L"Centaur", L"Avenir Next Condensed,Noteworthy,Impact", 2,
- 1252},
- {0x8ee4dcca, L"BookshelfSymbol7", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x90794800, L"BellGothicStdLight", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x909b516a, L"Century", L"Damascus,Andale Mono,Songti SC,Arial Unicode MS",
- 2, 1252},
- {0x92ae370d, L"MSOutlook", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
- {0x93c9fbf1, L"LucidaFax",
- L"PT Sans Narrow,Papyrus,Kokonor,Geeza Pro,Arial Rounded MT Bold,Lucida "
- L"Grande,Futura",
- 2, 1252},
- {0x9565085e, L"BookAntiqua", L"Palatino,Microsoft Sans Serif,Apple Symbols",
- 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"AHiragino Sans GB,Heiti TC,STHeiti", 0,
- 949},
- {0x9bbadd6b, L"ColonnaMT", L"Noteworthy,Avenir Next Condensed,Impact", 0,
- 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg",
- L"Arial Unicode MS,Georgia,American Typewriter", 0, 1252},
- {0x9d73008e, L"MSSansSerif", L"Songti SC,Apple Symbols", 0, 1252},
- {0xa0607db1, L"GungsuhChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE,Arial Unicode MS,Heiti TC,STFangsong",
- 1, 1252},
- {0xa0bcf6a1, L"LatinWide", L"Zapfino,Arial Black,STHeiti", 2, 1252},
- {0xa1429b36, L"Symbol", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xa1fa5abc, L"Wingdings2", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xa1fa5abd, L"Wingdings3", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular",
- L"STIXNonUnicode,Arial Narrow,Avenir Next Condensed Demi Bold", 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0xa8d83ece, L"CalifornianFB",
- L"American Typewriter,Avenir Next Condensed,Impact", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic",
- L"STIXVariants,STIXSizeOneSym,Apple Braille", 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic",
- L"STIXNonUnicode,Avenir Medium,Avenir Next Medium,Arial Unicode MS", 0,
- 1252},
- {0xade5337c, L"MSUIGothic", L"Arial Unicode MS,Apple SD Gothic Neo", 0,
- 1252},
- {0xb08dd941, L"WideLatin",
- L"Marion,Papyrus,Nanum Pen Script,Zapf Dingbats,Damascus,Zapfino,Arial "
- L"Black,STHeiti",
- 2, 1252},
- {0xb12765e0, L"ITCLegacySansStdBook",
- L"LastResort,.Helvetica Neue Desk UI,Arial Unicode MS,Palatino", 0, 1252},
- {0xb207f05d, L"PoorRichard", L"Noteworthy,Avenir Next Condensed,Impact", 2,
- 1252},
- {0xb3bc492f, L"JuiceITC-Regular", L"Nadeem,Al Bayan,STIXNonUnicode", 0,
- 1252},
- {0xb5545399, L"Marlett", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
- {0xb5dd1ebb, L"BritannicBold",
- L"Damascus,STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans", 0, 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic", L"STHeiti,Arial Black", 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Microsoft Sans Serif,Apple Symbols", 2,
- 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR", L"Heiti TC,STHeiti", 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold",
- L"American Typewriter,Avenir Next Condensed Heavy", 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0xc16c0118, L"AdobeHebrew",
- L".Helvetica Neue Desk UI,Palatino,American Typewriter", 0, 1252},
- {0xc318b0af, L"MyriadProLight", L"Palatino,Baskerville,Marion", 0, 1252},
- {0xc65e5659, L"CambriaMath", L"Arial Unicode MS", 2, 1252},
- {0xc75c8f05, L"LucidaConsole", L"Courier New,Menlo,Andale Mono", 1, 1252},
- {0xca7c35d6, L"Calibri", L"Apple Symbols,HeadLineA", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei", L"Arial Unicode MS", 0, 936},
- {0xcb7190f9, L"Magneto-Bold", L"Lucida Grande", 0, 1252},
- {0xcca00cc5, L"System", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular", L"Lucida Grande", 0, 1252},
- {0xccc5818c, L"EuroSign", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic",
- L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xcf7b8fdb, L"MinionPro",
- L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
- {0xcfe5755f, L"Simhei", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0xd011f4ee, L"MSPGothic", L"Arial Unicode MS,Apple SD Gothic Neo", 0,
- 1252},
- {0xd060e7ef, L"Vivaldi",
- L"STIXNonUnicode,Arial Unicode MS,Avenir Medium,Avenir Next Medium", 8,
- 1252},
- {0xd07edec1, L"FranklinGothic-Medium", L"Impact,Arial Narrow", 0, 1252},
- {0xd107243f, L"SimSun", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0xd1881562, L"ArialNarrow", L"PT Sans Narrow,Apple Symbols", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed",
- L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xd22bfa60, L"ComicSansMS",
- L"Damascus,Georgia,.Helvetica Neue Desk UI,Lucida Grande,Arial Unicode MS",
- 8, 1252},
- {0xd3bd0e35, L"Bauhaus93",
- L"STIXNonUnicode,Arial Unicode MS,Avenir Next,Avenir", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xd6679c12, L"BernardMTCondensed",
- L"Impact,Avenir Next Condensed Demi Bold", 0, 1252},
- {0xd8e8a027, L"LucidaSans",
- L"Arial Narrow,Khmer MN,Kokonor,Damascus,Microsoft Sans Serif,Apple "
- L"Symbols",
- 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg",
- L"STIXGeneral,.Helvetica Neue Desk UI,Trebuchet MS", 2, 1252},
- {0xda7e551e, L"STSong", L"Arial Unicode MS", 0, 936},
- {0xdaa6842d, L"STZhongsong", L"STFangsong,Songti SC,STSong", 0, 936},
- {0xdaaab93f, L"STFangsong", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdaeb0713, L"STSong", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdafedbef, L"STCaiyun", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0xdb00a3d9, L"Broadway",
- L"Papyrus,STIXNonUnicode,Arial Black,Avenir Next Heavy,Heiti TC", 0, 1252},
- {0xdb1f5ad4, L"STXinwei", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0xdb326e7f, L"STKaiti", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdb69595a, L"STHupo", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0xdba0082c, L"STXihei", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdbd0ab18, L"STXingkai", L"Kaiti SC,Songti SC", 0, 936},
- {0xdc1a7db1, L"STLiti", L"Kaiti SC,Songti SC", 0, 936},
- {0xdc33075f, L"KristenITC-Regular",
- L"STIXNonUnicode,Damascus,Songti SC,STSong", 8, 1252},
- {0xdcc7009c, L"Harrington",
- L"STIXNonUnicode,Avenir Next Condensed Heavy,Noteworthy", 0, 1252},
- {0xdd712466, L"ArialBlack", L"Geeza Pro,Damascus,Songti SC,STSong", 0,
- 1252},
- {0xdde87b3e, L"Impact", L"Arial Narrow,Marion", 0, 1252},
- {0xdf69fb32, L"SnapITC",
- L"Arial Narrow,PT Sans Narrow,Marion,STHeiti,Arial Black", 0, 1252},
- {0xdf8b25e8, L"CenturyGothic",
- L"Damascus,Andale Mono,Songti SC,Arial Unicode MS", 0, 1252},
- {0xe0f705c0, L"KristenITC", L"Songti SC,STSong", 8, 1252},
- {0xe1427573, L"Raavi",
- L"Damascus,STIXNonUnicode,Marion,Papyrus,Avenir Next Condensed "
- L"Heavy,American Typewriter",
- 0, 1252},
- {0xe2cea0cb, L"Magneto",
- L"STIXNonUnicode,Damascus,Geeza Pro,Lucida Grande,Georgia,Heiti TC", 0,
- 1252},
- {0xe36a9e17, L"Ravie", L"STHeiti,Arial Black", 0, 1252},
- {0xe433f8e2, L"Parchment", L"Microsoft Sans Serif,Apple Symbols", 8, 1252},
- {0xe43dff4a, L"Wingdings", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
- {0xe4e2c405, L"MTExtra", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xe618cc35, L"InformalRoman", L"Arial Narrow", 8, 1252},
- {0xe6c27ffc, L"Mistral", L"Apple Symbols", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"Courier New", 0, 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0xe90fb013, L"TempusSansITC",
- L"STIXNonUnicode,Microsoft Sans Serif,Avenir Light", 0, 1252},
- {0xec637b42, L"Consolas",
- L"AR PL UKai CN,AR PL UKai HK,AR PL UKai TW,AR PL UKai TW MBE,AR PL UMing "
- L"CN,AR PL UMing HK,Microsoft Sans Serif,Tahoma",
- 1, 1252},
- {0xed3a683b, L"STXinwei", L"Kaiti SC,Songti SC,", 0, 936},
- {0xef264cd1, L"LucidaHandwriting",
- L"Arial Narrow,Avenir Next Condensed Demi Bold,Avenir Next "
- L"Condensed,Avenir Next Condensed Medium,STHeiti,Arial Black",
- 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace",
- L"STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans", 0, 1252},
- {0xf1028030, L"Mangal",
- L"Arial Unicode MS,Microsoft Sans Serif,Arial Narrow,Tahoma", 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic",
- L"Papyrus,Arial Unicode MS,Georgia,American Typewriter", 0, 1252},
- {0xf210f06a, L"ArialMT",
- L"Arial Unicode MS,Arial Narrow,STIXNonUnicode,Damascus,Avenir Next "
- L"Condensed Demi Bold,Avenir Next Condensed Medium,Avenir Next Condensed",
- 0, 1252},
- {0xf477f16a, L"Latha",
- L"Arial Narrow,Damascus,STIXNonUnicode,American Typewriter", 0, 1252},
- {0xf616f3dd, L"LiSu", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei", L"Arial Unicode MS", 0, 936},
- {0xfcd19697, L"BookmanOldStyle",
- L"Geeza Pro,Damascus,Andale Mono,Songti SC,Arial Unicode MS", 0, 1252},
- {0xfe209a82, L"LucidaCalligraphy",
- L"Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black", 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular", L"Heiti TC,STHeiti", 0, 936},
-};
-#elif _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun", L"Droid Sans Fallback", 0, 936},
- {0x01e4f102, L"YouYuan", L"Droid Sans Fallback", 1, 936},
- {0x030549dc, L"LiSu", L"Droid Sans Fallback", 1, 936},
- {0x032edd44, L"Simhei", L"Droid Sans Fallback", 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback,Droid Arabic "
- L"Naskh,Droid Sans Ethiopic",
- 2, 1252},
- {0x03ed90e6, L"Nina",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain",
- L"Droid Sans Thai,Droid Sans Armenian,Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,Droid Sans Fallback",
- 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif", L"Droid Sans Fallback", 0, 1252},
- {0x089b18a9, L"Arial", L"Droid Sans Fallback", 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x0bb003e7, L"Kartika",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 2, 1252},
- {0x0bb469df, L"VinerHandITC",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Droid Sans Fallback", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x0cfcb9c1, L"AdobeThai",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 847},
- {0x0e7de0f9, L"Playbill",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x0eff47c3, L"STHupo", L"Droid Sans Fallback", 0, 936},
- {0x107ad374, L"Constantia",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x12194c2d, L"KunstlerScript",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x135ef6a1, L"MinionProSmBd",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x158c4049, L"Garamond",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x160ecb24, L"STZhongsong", L"Droid Sans Fallback", 0, 936},
- {0x161ed07e, L"MSGothic", L"Droid Sans Fallback", 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x18d1188f, L"Cambria", L"Droid Sans Fallback", 2, 1252},
- {0x18eaf350, L"ArialUnicodeMS", L"Droid Sans Fallback", 0, 936},
- {0x1a92d115, L"MingLiU", L"Droid Sans Fallback", 1, 1252},
- {0x1cc217c6, L"TrebuchetMS",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x1d649596, L"BasemicTimes",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x1e34ee60, L"BellMT",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x1eb36945, L"CooperBlack",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x1ef7787d, L"BatangChe", L"Droid Sans Fallback", 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT", L"Droid Arabic Naskh,Droid Sans Ethiopic", 8,
- 1252},
- {0x220877aa, L"Candara",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x251059c3, L"Chiller",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 0, 1252},
- {0x25bed6dd, L"MSReferenceSansSerif", L"Droid Sans Fallback", 0, 1252},
- {0x28154c81, L"Parchment-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x29711eb9, L"STLiti", L"Droid Sans Fallback", 0, 936},
- {0x2b1993b4, L"Basemic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2c147529, L"FootlightMTLight",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2c198928, L"HarlowSolid",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"Droid Sans Fallback", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3115525a, L"FangSong_GB2312", L"Droid Sans Fallback", 0, 1252},
- {0x31327817, L"MyriadPro",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x32244975, L"Helvetica",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 0, 1252},
- {0x32ac995c, L"Terminal",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x33bb65f2, L"Sylfaen",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x3402c30e, L"MSPMincho", L"Droid Sans Fallback", 2, 1252},
- {0x3412bf31, L"SimSun-PUA", L"Droid Sans Fallback", 0, 936},
- {0x36eb39b9, L"BerlinSansFB",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x3a257d03, L"FangSong_GB2312", L"Droid Sans Fallback", 0, 1252},
- {0x3cdae668, L"FreestyleScript",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x3d55aed7, L"Jokerman",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3d5b4385, L"PMingLiU", L"Droid Sans Fallback", 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3e532d74, L"FranklinGothicMedium",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3e6aa32d, L"NSimSun", L"Droid Sans Fallback", 1, 936},
- {0x3f6c36a8, L"Gautami",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono,Droid Sans Fallback",
- 0, 1252},
- {0x3ff32662, L"Chiller-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x409de312, L"ModernNo.20",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x41443c5e, L"Georgia",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x4160ade5, L"BellGothicStdBlack",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x421976c4, L"Modern-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x422a7252, L"Stencil",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x42c8554f, L"Fixedsys",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x435cb41d, L"Roman",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x47882383, L"CourierNew", L"Droid Sans Fallback", 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x480bf7a4, L"CourierStd", L"Droid Sans Fallback", 0, 1252},
- {0x481ad6ed, L"VladimirScript",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x4911577a, L"YouYuan", L"Droid Sans Fallback", 1, 936},
- {0x4a788d72, L"STXingkai", L"Droid Sans Fallback", 0, 936},
- {0x4bf88566, L"SegoeCondensed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x4ea967ce, L"GulimChe", L"Droid Sans Fallback", 1, 1252},
- {0x4f68bd79, L"LetterGothicStd",
- L"Droid Sans Mono,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
- L"Mono,Droid Serif,Droid Sans Fallback",
- 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x531b3dea, L"BasemicSymbol",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x5333fd39, L"CalifornianFB-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter",
- L"Droid Sans Mono,Droid Arabic Naskh,Droid Sans Ethiopic", 0, 1252},
- {0x574d4d3d, L"AdobeArabic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x5792e759, L"STKaiti", L"Droid Sans Fallback", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Droid Sans Fallback", 0, 1252},
- {0x594e2da4, L"Vrinda",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x59baa9a2, L"KaiTi_GB2312", L"Droid Sans Fallback", 0, 1252},
- {0x5cfedf4f, L"BaskOldFace",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x5f97921c, L"AdobeMyungjoStdM", L"Droid Sans Fallback", 0, 936},
- {0x5fefbfad, L"Batang", L"Droid Sans Fallback", 2, 1252},
- {0x605342b9, L"DotumChe", L"Droid Sans Fallback", 1, 1252},
- {0x608c5f9a, L"KaiTi_GB2312", L"Droid Sans Fallback", 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x626608a9, L"MVBoli",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x630501a3, L"SmallFonts",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0x673a9e5f, L"Tunga",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono,Droid Sans Fallback",
- 0, 1252},
- {0x691aa4ce, L"NiagaraSolid",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x696259b7, L"Corbel",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x696ee9be, L"STXihei", L"Droid Sans Fallback", 0, 936},
- {0x6c59cf69, L"Dotum", L"Droid Sans Fallback", 0, 1252},
- {0x707fa561, L"Gungsuh", L"Droid Sans Fallback", 2, 1252},
- {0x71416bb2, L"ZWAdobeF",
- L"Droid Arabic Naskh,Droid Sans Armenian,Droid Sans Ethiopic,Droid Sans "
- L"Georgian,Droid Sans Hebrew,Droid Sans Thai",
- 0, 1252},
- {0x71b41801, L"Verdana",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Droid Sans Fallback", 0, 1252},
- {0x73f4d19f, L"NiagaraEngraved",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x74001694, L"MyriadProBlack", L"Book Antiqua,Constantia,Dotum,Georgia", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x74cb44ee, L"NSimSun", L"Droid Sans Fallback", 1, 936},
- {0x76b4d7ff, L"Shruti",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x788b3533, L"Webdings",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0x797dde99, L"MSSerif",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x7a0f9e9e, L"MSMincho", L"Droid Sans Fallback", 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x8213a433, L"LucidaSans-Typewriter",
- L"Droid Sans Mono,Droid Serif,Roboto,Droid Sans Fallback", 0, 1252},
- {0x82fec929, L"AdobeSongStdL", L"Droid Sans Fallback", 0, 936},
- {0x83581825, L"Modern",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x835a2823, L"Algerian",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x83dab9f5, L"Script",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x847b56da, L"Tahoma", L"Droid Sans Fallback", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA", L"Droid Sans Fallback", 0, 1252},
- {0x8b5cac0e, L"Onyx",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x8c6a499e, L"Gulim", L"Droid Sans Fallback", 0, 1252},
- {0x8e0af790, L"JuiceITC",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x8e8d43b2, L"Centaur",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x8ee4dcca, L"BookshelfSymbol7",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x90794800, L"BellGothicStdLight",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x909b516a, L"Century",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x92ae370d, L"MSOutlook",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
- {0x93c9fbf1, L"LucidaFax",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 2, 1252},
- {0x9565085e, L"BookAntiqua",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"Droid Sans Fallback", 0, 949},
- {0x9bbadd6b, L"ColonnaMT",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallbac", 0, 1252},
- {0x9d73008e, L"MSSansSerif",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xa0607db1, L"GungsuhChe", L"Droid Sans Fallback", 1, 1252},
- {0xa0bcf6a1, L"LatinWide",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xa1429b36, L"Symbol",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xa1fa5abc, L"Wingdings2",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xa1fa5abd, L"Wingdings3",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic", 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0xa8d83ece, L"CalifornianFB",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xade5337c, L"MSUIGothic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xb08dd941, L"WideLatin",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 2, 1252},
- {0xb207f05d, L"PoorRichard",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xb3bc492f, L"JuiceITC-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xb5545399, L"Marlett",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
- {0xb5dd1ebb, L"BritannicBold", L"Droid Arabic Naskh,Droid Sans Ethiopic", 0,
- 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Droid Sans Fallback", 2, 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR", L"Droid Sans Fallback", 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xc16c0118, L"AdobeHebrew",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback,Droid Arabic "
- L"Naskh,Droid Sans Ethiopic",
- 0, 1252},
- {0xc318b0af, L"MyriadProLight",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xc65e5659, L"CambriaMath", L"Droid Sans Fallback", 2, 1252},
- {0xc75c8f05, L"LucidaConsole",
- L"Droid Sans Mono,Droid Serif,Roboto,Droid Sans Fallback", 1, 1252},
- {0xca7c35d6, L"Calibri", L"Droid Sans Fallback", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei", L"Droid Sans Fallback", 0, 936},
- {0xcb7190f9, L"Magneto-Bold",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcca00cc5, L"System",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xccc5818c, L"EuroSign",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcf7b8fdb, L"MinionPro",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcfe5755f, L"Simhei", L"Droid Sans Fallback", 1, 936},
- {0xd011f4ee, L"MSPGothic", L"Droid Sans Fallback", 0, 1252},
- {0xd060e7ef, L"Vivaldi",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0xd07edec1, L"FranklinGothic-Medium",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd107243f, L"SimSun", L"Droid Sans Fallback", 0, 936},
- {0xd1881562, L"ArialNarrow",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd22bfa60, L"ComicSansMS", L"Droid Serif,Roboto,Droid Sans Fallback", 8,
- 1252},
- {0xd3bd0e35, L"Bauhaus93",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"Droid Sans Fallback", 0, 936},
- {0xd6679c12, L"BernardMTCondensed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd8e8a027, L"LucidaSans",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xda7e551e, L"STSong", L"Droid Sans Fallback", 0, 936},
- {0xdaa6842d, L"STZhongsong", L"Droid Sans Fallback", 0, 936},
- {0xdaaab93f, L"STFangsong", L"Droid Sans Fallback", 0, 936},
- {0xdaeb0713, L"STSong",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 936},
- {0xdafedbef, L"STCaiyun", L"Droid Sans Fallback", 0, 936},
- {0xdb00a3d9, L"Broadway",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdb1f5ad4, L"STXinwei", L"Droid Sans Fallback", 0, 936},
- {0xdb326e7f, L"STKaiti", L"Droid Sans Fallback", 0, 936},
- {0xdb69595a, L"STHupo", L"Droid Sans Fallback", 0, 936},
- {0xdba0082c, L"STXihei", L"Droid Sans Fallback", 0, 936},
- {0xdbd0ab18, L"STXingkai", L"Droid Sans Fallback", 0, 936},
- {0xdc1a7db1, L"STLiti", L"Droid Sans Fallback", 0, 936},
- {0xdc33075f, L"KristenITC-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 8, 1252},
- {0xdcc7009c, L"Harrington",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdd712466, L"ArialBlack",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdde87b3e, L"Impact",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdf69fb32, L"SnapITC",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xdf8b25e8, L"CenturyGothic",
- L"Droid Serif,Roboto,Droid Serif,Droid Sans Mono", 0, 1252},
- {0xe0f705c0, L"KristenITC",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 8, 1252},
- {0xe1427573, L"Raavi",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xe2cea0cb, L"Magneto",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xe36a9e17, L"Ravie",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xe433f8e2, L"Parchment",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0xe43dff4a, L"Wingdings",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
- {0xe4e2c405, L"MTExtra",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xe618cc35, L"InformalRoman",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 8, 1252},
- {0xe6c27ffc, L"Mistral",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"Droid Sans Fallback", 0, 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xe90fb013, L"TempusSansITC",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xec637b42, L"Consolas", L"Droid Sans Fallback", 1, 1252},
- {0xed3a683b, L"STXinwei", L"Droid Sans Fallback", 0, 936},
- {0xef264cd1, L"LucidaHandwriting",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xf1028030, L"Mangal",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallbac", 0, 1252},
- {0xf210f06a, L"ArialMT",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 0, 1252},
- {0xf477f16a, L"Latha",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xf616f3dd, L"LiSu", L"Droid Sans Fallback", 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei", L"Droid Sans Fallback", 0, 936},
- {0xfcd19697, L"BookmanOldStyle",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xfe209a82, L"LucidaCalligraphy",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular", L"Droid Sans Fallback", 0, 936},
-};
-#endif
-
-CFX_WideString XFA_LocalFontNameToEnglishName(
- const CFX_WideStringC& wsLocalName) {
- uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true);
- const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
- const XFA_FONTINFO* pFontInfo =
- std::lower_bound(g_XFAFontsMap, pEnd, dwLocalNameHash,
- [](const XFA_FONTINFO& entry, uint32_t hash) {
- return entry.dwFontNameHash < hash;
- });
- if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash)
- return pFontInfo->pPsName;
- return CFX_WideString(wsLocalName);
-}
-
-const XFA_FONTINFO* XFA_GetFontINFOByFontName(
- const CFX_WideStringC& wsFontName) {
- CFX_WideString wsFontNameTemp(wsFontName);
- wsFontNameTemp.Remove(L' ');
- uint32_t dwCurFontNameHash =
- FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true);
- const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
- const XFA_FONTINFO* pFontInfo =
- std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash,
- [](const XFA_FONTINFO& entry, uint32_t hash) {
- return entry.dwFontNameHash < hash;
- });
- if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwCurFontNameHash)
- return pFontInfo;
- return nullptr;
-}
-
-} // namespace
-
-CXFA_DefFontMgr::CXFA_DefFontMgr() {}
-
-CXFA_DefFontMgr::~CXFA_DefFontMgr() {}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- CFX_WideString wsFontName(wsFontFamily);
- CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
- CFX_RetainPtr<CFGAS_GEFont> pFont =
- pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage);
- if (!pFont) {
- const XFA_FONTINFO* pCurFont =
- XFA_GetFontINFOByFontName(wsFontName.AsStringC());
- if (pCurFont && pCurFont->pReplaceFont) {
- uint32_t dwStyle = 0;
- if (dwFontStyles & FX_FONTSTYLE_Bold) {
- dwStyle |= FX_FONTSTYLE_Bold;
- }
- if (dwFontStyles & FX_FONTSTYLE_Italic) {
- dwStyle |= FX_FONTSTYLE_Italic;
- }
- const FX_WCHAR* pReplace = pCurFont->pReplaceFont;
- int32_t iLength = FXSYS_wcslen(pReplace);
- while (iLength > 0) {
- const FX_WCHAR* pNameText = pReplace;
- while (*pNameText != L',' && iLength > 0) {
- pNameText++;
- iLength--;
- }
- CFX_WideString wsReplace =
- CFX_WideString(pReplace, pNameText - pReplace);
- pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage);
- if (pFont)
- break;
-
- iLength--;
- pNameText++;
- pReplace = pNameText;
- }
- }
- }
- if (pFont)
- m_CacheFonts.push_back(pFont);
- return pFont;
-}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetDefaultFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
- CFX_RetainPtr<CFGAS_GEFont> pFont =
- pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage);
- if (!pFont) {
- pFont = pFDEFontMgr->LoadFont(static_cast<const FX_WCHAR*>(nullptr),
- dwFontStyles, wCodePage);
- }
- if (pFont)
- m_CacheFonts.push_back(pFont);
- return pFont;
-}
-
-CXFA_PDFFontMgr::CXFA_PDFFontMgr(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
-
-CXFA_PDFFontMgr::~CXFA_PDFFontMgr() {}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont(
- const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic,
- CPDF_Font** pDstPDFFont,
- bool bStrictMatch) {
- CPDF_Document* pDoc = m_pDoc->GetPDFDoc();
- if (!pDoc)
- return nullptr;
-
- CPDF_Dictionary* pFontSetDict =
- pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR");
- if (!pFontSetDict)
- return nullptr;
-
- pFontSetDict = pFontSetDict->GetDictFor("Font");
- if (!pFontSetDict)
- return nullptr;
-
- CFX_ByteString name = strPsName;
- name.Remove(' ');
- CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr();
- for (const auto& it : *pFontSetDict) {
- const CFX_ByteString& key = it.first;
- CPDF_Object* pObj = it.second.get();
- if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key,
- bStrictMatch)) {
- continue;
- }
- CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect());
- if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") {
- return nullptr;
- }
- CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict);
- if (!pPDFFont) {
- return nullptr;
- }
- if (!pPDFFont->IsEmbedded()) {
- *pDstPDFFont = pPDFFont;
- return nullptr;
- }
- return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr);
- }
- return nullptr;
-}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::GetFont(
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- CPDF_Font** pPDFFont,
- bool bStrictMatch) {
- uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString strKey;
- strKey.Format("%u%u", dwHashCode, dwFontStyles);
- auto it = m_FontMap.find(strKey);
- if (it != m_FontMap.end())
- return it->second;
- CFX_ByteString bsPsName =
- CFX_ByteString::FromUnicode(CFX_WideString(wsFontFamily));
- bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold;
- bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic;
- CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic);
- CFX_RetainPtr<CFGAS_GEFont> pFont =
- FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch);
- if (pFont)
- m_FontMap[strKey] = pFont;
- return pFont;
-}
-
-CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName(
- const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic) {
- for (size_t i = 0; i < FX_ArraySize(g_XFAPDFFontName); ++i) {
- if (strPsName == g_XFAPDFFontName[i][0]) {
- size_t index = 1;
- if (bBold)
- ++index;
- if (bItalic)
- index += 2;
- return g_XFAPDFFontName[i][index];
- }
- }
- return strPsName;
-}
-
-bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
- bool bBold,
- bool bItalic,
- const CFX_ByteString& bsDRFontName,
- bool bStrictMatch) {
- CFX_ByteString bsDRName = bsDRFontName;
- bsDRName.Remove('-');
- int32_t iPsLen = bsPsName.GetLength();
- int32_t nIndex = bsDRName.Find(bsPsName);
- if (nIndex != -1 && !bStrictMatch)
- return true;
-
- if (nIndex != 0)
- return false;
-
- int32_t iDifferLength = bsDRName.GetLength() - iPsLen;
- if (iDifferLength > 1 || (bBold || bItalic)) {
- int32_t iBoldIndex = bsDRName.Find("Bold");
- bool bBoldFont = iBoldIndex > 0;
- if (bBold != bBoldFont)
- return false;
-
- if (bBoldFont) {
- iDifferLength =
- std::min(iDifferLength - 4, bsDRName.GetLength() - iBoldIndex - 4);
- }
- bool bItalicFont = true;
- if (bsDRName.Find("Italic") > 0) {
- iDifferLength -= 6;
- } else if (bsDRName.Find("It") > 0) {
- iDifferLength -= 2;
- } else if (bsDRName.Find("Oblique") > 0) {
- iDifferLength -= 7;
- } else {
- bItalicFont = false;
- }
- if (bItalic != bItalicFont)
- return false;
-
- if (iDifferLength > 1) {
- CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength);
- if (bsDRTailer == "MT" || bsDRTailer == "PSMT" ||
- bsDRTailer == "Regular" || bsDRTailer == "Reg") {
- return true;
- }
- if (bBoldFont || bItalicFont)
- return false;
-
- bool bMatch = false;
- switch (bsPsName.GetAt(iPsLen - 1)) {
- case 'L': {
- if (bsDRName.Right(5) == "Light") {
- bMatch = true;
- }
- } break;
- case 'R': {
- if (bsDRName.Right(7) == "Regular" || bsDRName.Right(3) == "Reg") {
- bMatch = true;
- }
- } break;
- case 'M': {
- if (bsDRName.Right(5) == "Medium") {
- bMatch = true;
- }
- } break;
- default:
- break;
- }
- return bMatch;
- }
- }
- return true;
-}
-
-bool CXFA_PDFFontMgr::GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- FX_WCHAR wUnicode,
- bool bCharCode,
- int32_t* pWidth) {
- if (wUnicode != 0x20 || bCharCode)
- return false;
-
- auto it = m_FDE2PDFFont.find(pFont);
- if (it == m_FDE2PDFFont.end())
- return false;
-
- CPDF_Font* pPDFFont = it->second;
- *pWidth = pPDFFont->GetCharWidthF(pPDFFont->CharCodeFromUnicode(wUnicode));
- return true;
-}
-
-void CXFA_PDFFontMgr::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- CPDF_Font* pPDFFont) {
- m_FDE2PDFFont[pFont] = pPDFFont;
-}
-
-CXFA_FontMgr::CXFA_FontMgr() {}
-
-CXFA_FontMgr::~CXFA_FontMgr() {}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString bsKey;
- bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
- auto iter = m_FontMap.find(bsKey);
- if (iter != m_FontMap.end())
- return iter->second;
-
- CFX_WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
- auto it = m_PDFFontMgrMap.find(hDoc);
- CXFA_PDFFontMgr* pMgr =
- it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr;
- CPDF_Font* pPDFFont = nullptr;
- CFX_RetainPtr<CFGAS_GEFont> pFont;
- if (pMgr) {
- pFont =
- pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, true);
- if (pFont)
- return pFont;
- }
- if (!pFont && m_pDefFontMgr)
- pFont = m_pDefFontMgr->GetFont(hDoc, wsFontFamily, dwFontStyles, wCodePage);
-
- if (!pFont && pMgr) {
- pPDFFont = nullptr;
- pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont,
- false);
- if (pFont)
- return pFont;
- }
- if (!pFont && m_pDefFontMgr) {
- pFont = m_pDefFontMgr->GetDefaultFont(hDoc, wsFontFamily, dwFontStyles,
- wCodePage);
- }
- if (pFont) {
- if (pPDFFont) {
- pMgr->SetFont(pFont, pPDFFont);
- pFont->SetFontProvider(pMgr);
- }
- m_FontMap[bsKey] = pFont;
- }
- return pFont;
-}
-
-void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) {
- if (!m_PDFFontMgrMap[hDoc])
- m_PDFFontMgrMap[hDoc] = pdfium::MakeUnique<CXFA_PDFFontMgr>(hDoc);
-}
-
-void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
- m_PDFFontMgrMap.erase(hDoc);
-}
-
-void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
- m_pDefFontMgr = std::move(pFontMgr);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp
index e1f3e202ed3..3cf6e5e8fdd 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {}
@@ -25,8 +25,8 @@ void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget) {
}
bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h
index c68fb7015f2..b4a34815885 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h
@@ -19,8 +19,8 @@ class CXFA_FWLAdapterWidgetMgr {
void RepaintWidget(CFWL_Widget* pWidget);
bool GetPopupPos(CFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp
index 73abaecbc89..629cd509e83 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fwl/cfwl_barcode.h"
@@ -22,13 +22,13 @@
#include "xfa/fwl/cfwl_scrollbar.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_themetext.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
namespace {
-const FX_WCHAR* const g_FWLTheme_CalFonts[] = {
+const wchar_t* const g_FWLTheme_CalFonts[] = {
L"Arial", L"Courier New", L"DejaVu Sans",
};
@@ -44,18 +44,18 @@ CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget) {
}
CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp)
- : m_pCheckBoxTP(new CFWL_CheckBoxTP),
- m_pListBoxTP(new CFWL_ListBoxTP),
- m_pPictureBoxTP(new CFWL_PictureBoxTP),
- m_pSrollBarTP(new CFWL_ScrollBarTP),
- m_pEditTP(new CFWL_EditTP),
- m_pComboBoxTP(new CFWL_ComboBoxTP),
- m_pMonthCalendarTP(new CFWL_MonthCalendarTP),
- m_pDateTimePickerTP(new CFWL_DateTimePickerTP),
- m_pPushButtonTP(new CFWL_PushButtonTP),
- m_pCaretTP(new CFWL_CaretTP),
- m_pBarcodeTP(new CFWL_BarcodeTP),
- m_pTextOut(new CFDE_TextOut),
+ : m_pCheckBoxTP(pdfium::MakeUnique<CFWL_CheckBoxTP>()),
+ m_pListBoxTP(pdfium::MakeUnique<CFWL_ListBoxTP>()),
+ m_pPictureBoxTP(pdfium::MakeUnique<CFWL_PictureBoxTP>()),
+ m_pSrollBarTP(pdfium::MakeUnique<CFWL_ScrollBarTP>()),
+ m_pEditTP(pdfium::MakeUnique<CFWL_EditTP>()),
+ m_pComboBoxTP(pdfium::MakeUnique<CFWL_ComboBoxTP>()),
+ m_pMonthCalendarTP(pdfium::MakeUnique<CFWL_MonthCalendarTP>()),
+ m_pDateTimePickerTP(pdfium::MakeUnique<CFWL_DateTimePickerTP>()),
+ m_pPushButtonTP(pdfium::MakeUnique<CFWL_PushButtonTP>()),
+ m_pCaretTP(pdfium::MakeUnique<CFWL_CaretTP>()),
+ m_pBarcodeTP(pdfium::MakeUnique<CFWL_BarcodeTP>()),
+ m_pTextOut(pdfium::MakeUnique<CFDE_TextOut>()),
m_pCalendarFont(nullptr),
m_pApp(pApp) {
m_Rect.Reset();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h
index a8efad0ccff..33ea8e80a52 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h
@@ -22,7 +22,7 @@
#include "xfa/fwl/theme/cfwl_pushbuttontp.h"
#include "xfa/fwl/theme/cfwl_scrollbartp.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
-#include "xfa/fxfa/xfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
class CXFA_FWLTheme final : public IFWL_ThemeProvider {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp
deleted file mode 100644
index a855105e3dc..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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/fxfa/xfa_rendercontext.h"
-
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxgraphics/cfx_graphics.h"
-
-namespace {
-
-const int32_t kMaxCount = 30;
-
-} // namsepace
-
-CXFA_RenderContext::CXFA_RenderContext()
- : m_pWidget(nullptr), m_pPageView(nullptr), m_pGS(nullptr), m_dwStatus(0) {
- m_matrix.SetIdentity();
- m_rtClipRect.Reset();
-}
-
-CXFA_RenderContext::~CXFA_RenderContext() {}
-
-int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
- CFX_Graphics* pGS,
- const CFX_Matrix& matrix,
- const CXFA_RenderOptions& options) {
- m_pPageView = pPageView;
- m_pGS = pGS;
- m_matrix = matrix;
- m_options = options;
-
- CFX_Matrix mtRes;
- mtRes.SetReverse(matrix);
- m_rtClipRect = pGS->GetClipRect();
- mtRes.TransformRect(m_rtClipRect);
- m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
- uint32_t dwFilterType = XFA_WidgetStatus_Visible |
- (m_options.m_bPrint ? XFA_WidgetStatus_Printable
- : XFA_WidgetStatus_Viewable);
- m_pWidgetIterator.reset(
- m_pPageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, dwFilterType));
- m_pWidget = m_pWidgetIterator->MoveToNext();
- return XFA_RENDERSTATUS_Ready;
-}
-
-int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
- int32_t iCount = 0;
- while (m_pWidget) {
- CXFA_FFWidget* pWidget = m_pWidget;
- CFX_RectF rtWidgetBox = pWidget->GetBBox(XFA_WidgetStatus_Visible);
- rtWidgetBox.width += 1;
- rtWidgetBox.height += 1;
- if (rtWidgetBox.IntersectWith(m_rtClipRect))
- pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
-
- m_pWidget = m_pWidgetIterator->MoveToNext();
- iCount++;
- if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())
- return XFA_RENDERSTATUS_ToBeContinued;
- }
- return XFA_RENDERSTATUS_Done;
-}
-
-void CXFA_RenderContext::StopRender() {
- m_pWidgetIterator.reset();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h
index 6802df55664..fd1f3bdbaa4 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h
@@ -32,7 +32,7 @@ class XFA_TextPiece {
int32_t iPeriod;
int32_t iLineThrough;
FX_ARGB dwColor;
- FX_FLOAT fFontSize;
+ float fFontSize;
CFX_RectF rtPiece;
CFX_RetainPtr<CFGAS_GEFont> pFont;
CFX_RetainPtr<CXFA_LinkUserData> pLinkData;