From ec1843d2f61a85a7484627b828da317e4dd9c0a4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 28 Mar 2017 16:04:41 -0400 Subject: Renaming and splitting in xfa/fxfa/parser. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl renames several of the files in xfa/fxfa/parser to match the name of the contained classes. Files with multiple clasess are split apart when renamed. Change-Id: Ice8a1279072ee13c2f62a81946be7f42f9ba6007 Reviewed-on: https://pdfium-review.googlesource.com/3250 Commit-Queue: Nicolás Peña Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez --- BUILD.gn | 21 +- xfa/fgas/localization/cfx_formatstring.h | 2 +- xfa/fxfa/app/xfa_fftextedit.cpp | 2 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 2 +- xfa/fxfa/cxfa_widgetacc.cpp | 2 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 3 +- xfa/fxfa/parser/cscript_datawindow.cpp | 2 +- xfa/fxfa/parser/cscript_eventpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_logpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_signaturepseudomodel.cpp | 2 +- xfa/fxfa/parser/cxfa_document.cpp | 2 +- xfa/fxfa/parser/cxfa_document.h | 2 +- xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 2792 ++++++++++++++++++++++ xfa/fxfa/parser/cxfa_itemlayoutprocessor.h | 172 ++ xfa/fxfa/parser/cxfa_layoutcontext.h | 32 + xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 8 +- xfa/fxfa/parser/cxfa_layoutpagemgr.h | 6 +- xfa/fxfa/parser/cxfa_layoutprocessor.cpp | 4 +- xfa/fxfa/parser/cxfa_localemgr.cpp | 1249 ++++++++++ xfa/fxfa/parser/cxfa_localemgr.h | 59 + xfa/fxfa/parser/cxfa_localevalue.cpp | 982 ++++++++ xfa/fxfa/parser/cxfa_localevalue.h | 112 + xfa/fxfa/parser/cxfa_nodehelper.cpp | 2 +- xfa/fxfa/parser/cxfa_nodelocale.cpp | 193 ++ xfa/fxfa/parser/cxfa_nodelocale.h | 58 + xfa/fxfa/parser/cxfa_resolveprocessor.cpp | 2 +- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 2 +- xfa/fxfa/parser/cxfa_timezoneprovider.cpp | 36 + xfa/fxfa/parser/cxfa_timezoneprovider.h | 23 + xfa/fxfa/parser/cxfa_widgetdata.cpp | 2 +- xfa/fxfa/parser/cxfa_xmllocale.cpp | 209 ++ xfa/fxfa/parser/cxfa_xmllocale.h | 56 + xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 2791 --------------------- xfa/fxfa/parser/xfa_layout_itemlayout.h | 188 -- xfa/fxfa/parser/xfa_locale.cpp | 394 --- xfa/fxfa/parser/xfa_locale.h | 97 - xfa/fxfa/parser/xfa_localemgr.cpp | 1274 ---------- xfa/fxfa/parser/xfa_localemgr.h | 70 - xfa/fxfa/parser/xfa_localevalue.cpp | 982 -------- xfa/fxfa/parser/xfa_localevalue.h | 112 - xfa/fxfa/parser/xfa_utils.cpp | 4 +- 44 files changed, 6015 insertions(+), 5946 deletions(-) create mode 100644 xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp create mode 100644 xfa/fxfa/parser/cxfa_itemlayoutprocessor.h create mode 100644 xfa/fxfa/parser/cxfa_layoutcontext.h create mode 100644 xfa/fxfa/parser/cxfa_localemgr.cpp create mode 100644 xfa/fxfa/parser/cxfa_localemgr.h create mode 100644 xfa/fxfa/parser/cxfa_localevalue.cpp create mode 100644 xfa/fxfa/parser/cxfa_localevalue.h create mode 100644 xfa/fxfa/parser/cxfa_nodelocale.cpp create mode 100644 xfa/fxfa/parser/cxfa_nodelocale.h create mode 100644 xfa/fxfa/parser/cxfa_timezoneprovider.cpp create mode 100644 xfa/fxfa/parser/cxfa_timezoneprovider.h create mode 100644 xfa/fxfa/parser/cxfa_xmllocale.cpp create mode 100644 xfa/fxfa/parser/cxfa_xmllocale.h delete mode 100644 xfa/fxfa/parser/xfa_layout_itemlayout.cpp delete mode 100644 xfa/fxfa/parser/xfa_layout_itemlayout.h delete mode 100644 xfa/fxfa/parser/xfa_locale.cpp delete mode 100644 xfa/fxfa/parser/xfa_locale.h delete mode 100644 xfa/fxfa/parser/xfa_localemgr.cpp delete mode 100644 xfa/fxfa/parser/xfa_localemgr.h delete mode 100644 xfa/fxfa/parser/xfa_localevalue.cpp delete mode 100644 xfa/fxfa/parser/xfa_localevalue.h diff --git a/BUILD.gn b/BUILD.gn index 6d383510b4..6e5e7b2e82 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1666,6 +1666,9 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_font.h", "xfa/fxfa/parser/cxfa_image.cpp", "xfa/fxfa/parser/cxfa_image.h", + "xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp", + "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h", + "xfa/fxfa/parser/cxfa_layoutcontext.h", "xfa/fxfa/parser/cxfa_layoutitem.cpp", "xfa/fxfa/parser/cxfa_layoutitem.h", "xfa/fxfa/parser/cxfa_layoutpagemgr.cpp", @@ -1674,6 +1677,10 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_layoutprocessor.h", "xfa/fxfa/parser/cxfa_line.cpp", "xfa/fxfa/parser/cxfa_line.h", + "xfa/fxfa/parser/cxfa_localemgr.cpp", + "xfa/fxfa/parser/cxfa_localemgr.h", + "xfa/fxfa/parser/cxfa_localevalue.cpp", + "xfa/fxfa/parser/cxfa_localevalue.h", "xfa/fxfa/parser/cxfa_margin.cpp", "xfa/fxfa/parser/cxfa_margin.h", "xfa/fxfa/parser/cxfa_measurement.cpp", @@ -1682,6 +1689,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_nodehelper.cpp", "xfa/fxfa/parser/cxfa_nodehelper.h", "xfa/fxfa/parser/cxfa_nodelist.cpp", + "xfa/fxfa/parser/cxfa_nodelocale.cpp", + "xfa/fxfa/parser/cxfa_nodelocale.h", "xfa/fxfa/parser/cxfa_object.cpp", "xfa/fxfa/parser/cxfa_occur.cpp", "xfa/fxfa/parser/cxfa_occur.h", @@ -1703,6 +1712,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_text.cpp", "xfa/fxfa/parser/cxfa_text.h", "xfa/fxfa/parser/cxfa_thisproxy.cpp", + "xfa/fxfa/parser/cxfa_timezoneprovider.cpp", + "xfa/fxfa/parser/cxfa_timezoneprovider.h", "xfa/fxfa/parser/cxfa_tooltip.cpp", "xfa/fxfa/parser/cxfa_tooltip.h", "xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h", @@ -1720,6 +1731,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_widgetdata.h", "xfa/fxfa/parser/cxfa_xml_parser.cpp", "xfa/fxfa/parser/cxfa_xml_parser.h", + "xfa/fxfa/parser/cxfa_xmllocale.cpp", + "xfa/fxfa/parser/cxfa_xmllocale.h", "xfa/fxfa/parser/xfa_basic_data.cpp", "xfa/fxfa/parser/xfa_basic_data.h", "xfa/fxfa/parser/xfa_basic_data_attributes.cpp", @@ -1730,14 +1743,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/xfa_basic_data_packets.cpp", "xfa/fxfa/parser/xfa_document_datamerger_imp.cpp", "xfa/fxfa/parser/xfa_document_datamerger_imp.h", - "xfa/fxfa/parser/xfa_layout_itemlayout.cpp", - "xfa/fxfa/parser/xfa_layout_itemlayout.h", - "xfa/fxfa/parser/xfa_locale.cpp", - "xfa/fxfa/parser/xfa_locale.h", - "xfa/fxfa/parser/xfa_localemgr.cpp", - "xfa/fxfa/parser/xfa_localemgr.h", - "xfa/fxfa/parser/xfa_localevalue.cpp", - "xfa/fxfa/parser/xfa_localevalue.h", "xfa/fxfa/parser/xfa_object.h", "xfa/fxfa/parser/xfa_resolvenode_rs.h", "xfa/fxfa/parser/xfa_utils.cpp", diff --git a/xfa/fgas/localization/cfx_formatstring.h b/xfa/fgas/localization/cfx_formatstring.h index b93771d919..39319964aa 100644 --- a/xfa/fgas/localization/cfx_formatstring.h +++ b/xfa/fgas/localization/cfx_formatstring.h @@ -10,7 +10,7 @@ #include #include "xfa/fgas/localization/fgas_locale.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" class CFX_FormatString { public: diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 34c037441e..a8f5a3bcd0 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -26,7 +26,7 @@ #include "xfa/fxfa/cxfa_ffdocview.h" #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" -#include "xfa/fxfa/parser/xfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_localevalue.h" CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc) : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 9b531ed4fc..98dee06728 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -27,8 +27,8 @@ #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_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 6e76119115..1db2bcef0f 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -20,8 +20,8 @@ #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_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_utils.h" class CXFA_WidgetLayoutData { diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 8a42c2619c..218e58b096 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -20,8 +20,9 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_program.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_timezoneprovider.h" namespace { diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index c0354a112c..e7b4d2c56c 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -8,7 +8,7 @@ #include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index fdfcbbfd42..6ce8114a02 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -11,8 +11,8 @@ #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffwidgethandler.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index 45013ee5d6..2bc6787ae3 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -12,8 +12,8 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 1ebb20d2c1..842617e6e6 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -16,10 +16,10 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutitem.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp index 48ccce027f..f9430f5d75 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -8,7 +8,7 @@ #include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index e5874a61cc..609b5bd318 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -9,8 +9,8 @@ #include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 8585228b85..0a4e597c93 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -15,8 +15,8 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h index 3446b88382..80cdc1bb0c 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -13,7 +13,7 @@ #include #include "xfa/fxfa/fxfa.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" enum XFA_VERSION { diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp new file mode 100644 index 0000000000..50be211bb6 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -0,0 +1,2792 @@ +// 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/parser/cxfa_itemlayoutprocessor.h" + +#include +#include +#include +#include + +#include "third_party/base/ptr_util.h" +#include "third_party/base/stl_util.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" +#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_layoutcontext.h" +#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_occur.h" +#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +namespace { + +std::vector SeparateStringW(const wchar_t* pStr, + int32_t iStrLen, + wchar_t delimiter) { + std::vector ret; + if (!pStr) + return ret; + if (iStrLen < 0) + iStrLen = FXSYS_wcslen(pStr); + + const wchar_t* pToken = pStr; + const wchar_t* pEnd = pStr + iStrLen; + while (true) { + if (pStr >= pEnd || delimiter == *pStr) { + ret.push_back(CFX_WideString(pToken, pStr - pToken)); + pToken = pStr + 1; + if (pStr >= pEnd) + break; + } + pStr++; + } + return ret; +} + +void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem, + float* fWidth, + float* fHeight) { + CXFA_Node* pNode = pLayoutItem->m_pFormNode; + switch (pNode->GetElementType()) { + case XFA_Element::Subform: + case XFA_Element::Area: + case XFA_Element::ExclGroup: + case XFA_Element::SubformSet: { + if (*fWidth < -XFA_LAYOUT_FLOAT_PERCISION) + *fWidth = pLayoutItem->m_sSize.width; + if (*fHeight < -XFA_LAYOUT_FLOAT_PERCISION) + *fHeight = pLayoutItem->m_sSize.height; + break; + } + case XFA_Element::Draw: + case XFA_Element::Field: { + pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, *fWidth, + *fHeight); + break; + } + default: + ASSERT(false); + } +} + +CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, + bool* bContainerWidthAutoSize, + bool* bContainerHeightAutoSize) { + *bContainerWidthAutoSize = true; + *bContainerHeightAutoSize = true; + + XFA_Element eType = pFormNode->GetElementType(); + CXFA_Measurement mTmpValue; + CFX_SizeF containerSize; + if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && + pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) && + mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { + containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); + *bContainerWidthAutoSize = false; + } + if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && + pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) && + mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { + containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); + *bContainerHeightAutoSize = false; + } + if (*bContainerWidthAutoSize && eType == XFA_Element::Subform && + pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) && + mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { + containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); + *bContainerWidthAutoSize = false; + } + if (*bContainerHeightAutoSize && eType == XFA_Element::Subform && + pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) && + mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { + containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); + *bContainerHeightAutoSize = false; + } + return containerSize; +} + +CFX_SizeF CalculateContainerComponentSizeFromContentSize( + CXFA_Node* pFormNode, + bool bContainerWidthAutoSize, + float fContentCalculatedWidth, + bool bContainerHeightAutoSize, + float fContentCalculatedHeight, + const CFX_SizeF& currentContainerSize) { + CFX_SizeF componentSize = currentContainerSize; + CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); + CXFA_Measurement mTmpValue; + if (bContainerWidthAutoSize) { + componentSize.width = fContentCalculatedWidth; + if (pMarginNode) { + if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false)) + componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); + if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false)) + componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); + } + } + + if (bContainerHeightAutoSize) { + componentSize.height = fContentCalculatedHeight; + if (pMarginNode) { + if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false)) + componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); + if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue, + false)) { + componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); + } + } + } + return componentSize; +} + +void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, + const std::vector& rgSpecifiedColumnWidths, + XFA_ATTRIBUTEENUM eLayout) { + bool bContainerWidthAutoSize = true; + bool bContainerHeightAutoSize = true; + CFX_SizeF containerSize = CalculateContainerSpecifiedSize( + pLayoutRow->m_pFormNode, &bContainerWidthAutoSize, + &bContainerHeightAutoSize); + CXFA_Node* pMarginNode = + pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; + if (pMarginNode) { + fLeftInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); + fTopInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); + fRightInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); + fBottomInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); + } + + float fContentWidthLimit = + bContainerWidthAutoSize ? FLT_MAX + : containerSize.width - fLeftInset - fRightInset; + float fContentCurrentHeight = + pLayoutRow->m_sSize.height - fTopInset - fBottomInset; + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + float fCurrentColX = 0; + int32_t nCurrentColIdx = 0; + bool bMetWholeRowCell = false; + + for (auto* pLayoutChild = + static_cast(pLayoutRow->m_pFirstChild); + pLayoutChild; pLayoutChild = static_cast( + pLayoutChild->m_pNextSibling)) { + int32_t nOriginalColSpan = + pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); + int32_t nColSpan = nOriginalColSpan; + float fColSpanWidth = 0; + if (nColSpan == -1 || + nCurrentColIdx + nColSpan > + pdfium::CollectionSize(rgSpecifiedColumnWidths)) { + nColSpan = pdfium::CollectionSize(rgSpecifiedColumnWidths) - + nCurrentColIdx; + } + for (int32_t i = 0; i < nColSpan; i++) + fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i]; + + if (nColSpan != nOriginalColSpan) { + fColSpanWidth = + bMetWholeRowCell ? 0 : std::max(fColSpanWidth, + pLayoutChild->m_sSize.height); + } + if (nOriginalColSpan == -1) + bMetWholeRowCell = true; + + pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0); + pLayoutChild->m_sSize.width = fColSpanWidth; + if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) + continue; + + fCurrentColX += fColSpanWidth; + nCurrentColIdx += nColSpan; + float fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight; + UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight); + pLayoutChild->m_sSize.height = fNewHeight; + if (bContainerHeightAutoSize) { + fContentCalculatedHeight = + std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height); + } + } + + if (bContainerHeightAutoSize) { + for (CXFA_ContentLayoutItem* pLayoutChild = + (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; + pLayoutChild; + pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { + UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width, + &fContentCalculatedHeight); + float fOldChildHeight = pLayoutChild->m_sSize.height; + pLayoutChild->m_sSize.height = fContentCalculatedHeight; + CXFA_Node* pParaNode = + pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para); + if (pParaNode && pLayoutChild->m_pFirstChild) { + float fOffHeight = fContentCalculatedHeight - fOldChildHeight; + XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign); + switch (eVType) { + case XFA_ATTRIBUTEENUM_Middle: + fOffHeight = fOffHeight / 2; + break; + case XFA_ATTRIBUTEENUM_Bottom: + break; + case XFA_ATTRIBUTEENUM_Top: + default: + fOffHeight = 0; + break; + } + if (fOffHeight > 0) { + for (CXFA_ContentLayoutItem* pInnerLayoutChild = + (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild; + pInnerLayoutChild; + pInnerLayoutChild = + (CXFA_ContentLayoutItem*)pInnerLayoutChild->m_pNextSibling) { + pInnerLayoutChild->m_sPos.y += fOffHeight; + } + } + } + } + } + + if (bContainerWidthAutoSize) { + float fChildSuppliedWidth = fCurrentColX; + if (fContentWidthLimit < FLT_MAX && + fContentWidthLimit > fChildSuppliedWidth) { + fChildSuppliedWidth = fContentWidthLimit; + } + fContentCalculatedWidth = + std::max(fContentCalculatedWidth, fChildSuppliedWidth); + } else { + fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset; + } + + if (pLayoutRow->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) == + XFA_ATTRIBUTEENUM_Rl_row) { + for (CXFA_ContentLayoutItem* pLayoutChild = + (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; + pLayoutChild; + pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { + pLayoutChild->m_sPos.x = fContentCalculatedWidth - + pLayoutChild->m_sPos.x - + pLayoutChild->m_sSize.width; + } + } + pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize( + pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, + bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); +} + +void UpdatePendingItemLayout(CXFA_ItemLayoutProcessor* pProcessor, + CXFA_ContentLayoutItem* pLayoutItem) { + XFA_ATTRIBUTEENUM eLayout = + pLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + switch (eLayout) { + case XFA_ATTRIBUTEENUM_Row: + case XFA_ATTRIBUTEENUM_Rl_row: + RelocateTableRowCells(pLayoutItem, pProcessor->m_rgSpecifiedColumnWidths, + eLayout); + break; + default: + break; + } +} + +void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, + float fSplitPos, + CXFA_ContentLayoutItem* pTrailerLayoutItem, + bool bUseInherited) { + if (!pTrailerLayoutItem) + return; + + float fHeight = pTrailerLayoutItem->m_sSize.height; + if (bUseInherited) { + float fNewSplitPos = 0; + if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) + fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); + if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) + pProcessor->SplitLayoutItem(fNewSplitPos); + return; + } + + UpdatePendingItemLayout(pProcessor, pTrailerLayoutItem); + CXFA_Node* pMarginNode = + pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; + if (pMarginNode) { + fLeftInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); + fTopInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); + fRightInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); + fBottomInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); + } + + if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) { + pTrailerLayoutItem->m_sPos.y = pProcessor->m_fLastRowY; + pTrailerLayoutItem->m_sPos.x = pProcessor->m_fLastRowWidth; + pProcessor->m_pLayoutItem->m_sSize.width += + pTrailerLayoutItem->m_sSize.width; + pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); + return; + } + + float fNewSplitPos = 0; + if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) + fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); + + if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { + pProcessor->SplitLayoutItem(fNewSplitPos); + pTrailerLayoutItem->m_sPos.y = fNewSplitPos - fTopInset - fBottomInset; + } else { + pTrailerLayoutItem->m_sPos.y = fSplitPos - fTopInset - fBottomInset; + } + + switch (pTrailerLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { + case XFA_ATTRIBUTEENUM_Right: + pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - + fRightInset - + pTrailerLayoutItem->m_sSize.width; + break; + case XFA_ATTRIBUTEENUM_Center: + pTrailerLayoutItem->m_sPos.x = + (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - + pTrailerLayoutItem->m_sSize.width) / + 2; + break; + case XFA_ATTRIBUTEENUM_Left: + default: + pTrailerLayoutItem->m_sPos.x = fLeftInset; + break; + } + pProcessor->m_pLayoutItem->m_sSize.height += fHeight; + pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); +} + +void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, + CXFA_ContentLayoutItem* pLeaderLayoutItem) { + UpdatePendingItemLayout(pProcessor, pLeaderLayoutItem); + + CXFA_Node* pMarginNode = + pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); + float fLeftInset = 0; + float fRightInset = 0; + if (pMarginNode) { + fLeftInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); + fRightInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); + } + + float fHeight = pLeaderLayoutItem->m_sSize.height; + for (CXFA_ContentLayoutItem* pChildItem = + (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild; + pChildItem; + pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { + pChildItem->m_sPos.y += fHeight; + } + pLeaderLayoutItem->m_sPos.y = 0; + + switch (pLeaderLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { + case XFA_ATTRIBUTEENUM_Right: + pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - + fRightInset - + pLeaderLayoutItem->m_sSize.width; + break; + case XFA_ATTRIBUTEENUM_Center: + pLeaderLayoutItem->m_sPos.x = + (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - + pLeaderLayoutItem->m_sSize.width) / + 2; + break; + case XFA_ATTRIBUTEENUM_Left: + default: + pLeaderLayoutItem->m_sPos.x = fLeftInset; + break; + } + pProcessor->m_pLayoutItem->m_sSize.height += fHeight; + pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); +} + +void AddPendingNode(CXFA_ItemLayoutProcessor* pProcessor, + CXFA_Node* pPendingNode, + bool bBreakPending) { + pProcessor->m_PendingNodes.push_back(pPendingNode); + pProcessor->m_bBreakPending = bBreakPending; +} + +float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, + CXFA_Node* pCurChildNode) { + float fTotalHeight = 0; + if (pProcessor->m_PendingNodes.empty()) + return fTotalHeight; + + if (!pProcessor->m_pLayoutItem) { + pProcessor->m_pLayoutItem = + pProcessor->CreateContentLayoutItem(pCurChildNode); + pProcessor->m_pLayoutItem->m_sSize.clear(); + } + + while (!pProcessor->m_PendingNodes.empty()) { + auto pPendingProcessor = pdfium::MakeUnique( + pProcessor->m_PendingNodes.front(), nullptr); + pProcessor->m_PendingNodes.pop_front(); + pPendingProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr); + CXFA_ContentLayoutItem* pPendingLayoutItem = + pPendingProcessor->HasLayoutItem() + ? pPendingProcessor->ExtractLayoutItem() + : nullptr; + if (pPendingLayoutItem) { + AddLeaderAfterSplit(pProcessor, pPendingLayoutItem); + if (pProcessor->m_bBreakPending) + fTotalHeight += pPendingLayoutItem->m_sSize.height; + } + } + return fTotalHeight; +} + +XFA_ATTRIBUTEENUM GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) { + *bRootForceTb = false; + XFA_ATTRIBUTEENUM eLayoutMode; + if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, false)) + return eLayoutMode; + + CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); + if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) { + *bRootForceTb = true; + return XFA_ATTRIBUTEENUM_Tb; + } + return XFA_ATTRIBUTEENUM_Position; +} + +bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) { + if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) + return false; + + XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; + if (!bPreFind) + eItemType = XFA_NODEITEM_NextSibling; + + CXFA_Node* pPreContainer = + pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); + if (!pPreContainer) + return false; + + CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep); + if (pKeep) { + XFA_ATTRIBUTEENUM ePrevious; + XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; + if (!bPreFind) + eKeepType = XFA_ATTRIBUTE_Next; + + if (pKeep->TryEnum(eKeepType, ePrevious, false)) { + if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || + ePrevious == XFA_ATTRIBUTEENUM_PageArea) { + return true; + } + } + } + + pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep); + if (!pKeep) + return false; + + XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next; + if (!bPreFind) + eKeepType = XFA_ATTRIBUTE_Previous; + + XFA_ATTRIBUTEENUM eNext; + if (!pKeep->TryEnum(eKeepType, eNext, false)) + return false; + if (eNext == XFA_ATTRIBUTEENUM_ContentArea || + eNext == XFA_ATTRIBUTEENUM_PageArea) { + return true; + } + return false; +} + +bool FindBreakNode(CXFA_Node* pContainerNode, + CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages* nCurStage, + bool bBreakBefore) { + bool bFindRs = false; + for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; + pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { + XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; + if (!bBreakBefore) + eAttributeType = XFA_ATTRIBUTE_After; + + switch (pBreakNode->GetElementType()) { + case XFA_Element::BreakBefore: { + if (bBreakBefore) { + pCurActionNode = pBreakNode; + *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore; + bFindRs = true; + } + break; + } + case XFA_Element::BreakAfter: { + if (!bBreakBefore) { + pCurActionNode = pBreakNode; + *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter; + bFindRs = true; + } + break; + } + case XFA_Element::Break: + if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) { + pCurActionNode = pBreakNode; + *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore; + if (!bBreakBefore) + *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter; + + bFindRs = true; + } + break; + default: + break; + } + if (bFindRs) + break; + } + return bFindRs; +} + +void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { + CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify(); + CXFA_LayoutProcessor* pDocLayout = + pGenerateNode->GetDocument()->GetDocLayout(); + CXFA_NodeIteratorTemplate sIterator( + pGenerateNode); + for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; + pNode = sIterator.MoveToNext()) { + CXFA_ContentLayoutItem* pCurLayoutItem = + (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); + CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; + while (pCurLayoutItem) { + pNextLayoutItem = pCurLayoutItem->m_pNext; + pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); + delete pCurLayoutItem; + pCurLayoutItem = pNextLayoutItem; + } + } + pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); +} + +uint8_t HAlignEnumToInt(XFA_ATTRIBUTEENUM eHAlign) { + switch (eHAlign) { + case XFA_ATTRIBUTEENUM_Center: + return 1; + case XFA_ATTRIBUTEENUM_Right: + return 2; + case XFA_ATTRIBUTEENUM_Left: + default: + return 0; + } +} + +XFA_ItemLayoutProcessorResult InsertFlowedItem( + CXFA_ItemLayoutProcessor* pThis, + CXFA_ItemLayoutProcessor* pProcessor, + bool bContainerWidthAutoSize, + bool bContainerHeightAutoSize, + float fContainerHeight, + XFA_ATTRIBUTEENUM eFlowStrategy, + uint8_t* uCurHAlignState, + std::vector (&rgCurLineLayoutItems)[3], + bool bUseBreakControl, + float fAvailHeight, + float fRealHeight, + float fContentWidthLimit, + float* fContentCurRowY, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, + bool* bAddedItemInRow, + bool* bForceEndPage, + CXFA_LayoutContext* pLayoutContext, + bool bNewRow) { + bool bTakeSpace = + XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); + uint8_t uHAlign = + HAlignEnumToInt(pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign)); + if (bContainerWidthAutoSize) + uHAlign = 0; + + if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb && + uHAlign < *uCurHAlignState) || + (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb && + uHAlign > *uCurHAlignState)) { + return XFA_ItemLayoutProcessorResult::RowFullBreak; + } + + *uCurHAlignState = uHAlign; + bool bIsOwnSplit = + pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None; + bool bUseRealHeight = + bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit && + pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() == + XFA_ATTRIBUTEENUM_None; + bool bIsTransHeight = bTakeSpace; + if (bIsTransHeight && !bIsOwnSplit) { + bool bRootForceTb = false; + XFA_ATTRIBUTEENUM eLayoutStrategy = + GetLayout(pProcessor->m_pFormNode, &bRootForceTb); + if (eLayoutStrategy == XFA_ATTRIBUTEENUM_Lr_tb || + eLayoutStrategy == XFA_ATTRIBUTEENUM_Rl_tb) { + bIsTransHeight = false; + } + } + + bool bUseInherited = false; + CXFA_LayoutContext layoutContext; + if (pThis->m_pPageMgr) { + CXFA_Node* pOverflowNode = + pThis->m_pPageMgr->QueryOverflow(pThis->m_pFormNode); + if (pOverflowNode) { + layoutContext.m_pOverflowNode = pOverflowNode; + layoutContext.m_pOverflowProcessor = pThis; + pLayoutContext = &layoutContext; + } + } + + XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult::Done; + if (!bNewRow || + pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult::Done) { + eRetValue = pProcessor->DoLayout( + bTakeSpace ? bUseBreakControl : false, + bUseRealHeight ? fRealHeight - *fContentCurRowY : FLT_MAX, + bIsTransHeight ? fRealHeight - *fContentCurRowY : FLT_MAX, + pLayoutContext); + pProcessor->m_ePreProcessRs = eRetValue; + } else { + eRetValue = pProcessor->m_ePreProcessRs; + pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult::Done; + } + if (pProcessor->HasLayoutItem() == false) + return eRetValue; + + CFX_SizeF childSize = pProcessor->GetCurrentComponentSize(); + if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) { + fRealHeight = FLT_MAX; + fAvailHeight = FLT_MAX; + } + if (bTakeSpace && (childSize.width > + *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) && + (fContentWidthLimit - *fContentCurRowAvailWidth > + XFA_LAYOUT_FLOAT_PERCISION)) { + return XFA_ItemLayoutProcessorResult::RowFullBreak; + } + + CXFA_Node* pOverflowLeaderNode = nullptr; + CXFA_Node* pOverflowTrailerNode = nullptr; + CXFA_Node* pFormNode = nullptr; + CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr; + bool bIsAddTrailerHeight = false; + if (pThis->m_pPageMgr && + pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { + pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); + if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) { + pFormNode = pLayoutContext->m_pOverflowNode; + bUseInherited = true; + } + if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, + pOverflowTrailerNode, false, + false)) { + if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { + if (pOverflowTrailerNode) { + auto pOverflowLeaderProcessor = + pdfium::MakeUnique(pOverflowTrailerNode, + nullptr); + pOverflowLeaderProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr); + pTrailerLayoutItem = + pOverflowLeaderProcessor->HasLayoutItem() + ? pOverflowLeaderProcessor->ExtractLayoutItem() + : nullptr; + } + + bIsAddTrailerHeight = + bUseInherited + ? pThis->IsAddNewRowForTrailer(pTrailerLayoutItem) + : pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); + if (bIsAddTrailerHeight) { + childSize.height += pTrailerLayoutItem->m_sSize.height; + bIsAddTrailerHeight = true; + } + } + } + } + + if (!bTakeSpace || + *fContentCurRowY + childSize.height <= + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION || + (!bContainerHeightAutoSize && + pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >= + fContainerHeight)) { + if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) { + if (pProcessor->m_bUseInheriated) { + if (pTrailerLayoutItem) + AddTrailerBeforeSplit(pProcessor, childSize.height, + pTrailerLayoutItem, false); + if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) + AddPendingNode(pProcessor, pOverflowLeaderNode, false); + + pProcessor->m_bUseInheriated = false; + } else { + if (bIsAddTrailerHeight) + childSize.height -= pTrailerLayoutItem->m_sSize.height; + + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, + pOverflowTrailerNode, + pTrailerLayoutItem, pFormNode); + } + + CXFA_ContentLayoutItem* pChildLayoutItem = + pProcessor->ExtractLayoutItem(); + if (ExistContainerKeep(pProcessor->m_pFormNode, false) && + pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { + pThis->m_arrayKeepItems.push_back(pChildLayoutItem); + } else { + pThis->m_arrayKeepItems.clear(); + } + rgCurLineLayoutItems[uHAlign].push_back(pChildLayoutItem); + *bAddedItemInRow = true; + if (bTakeSpace) { + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); + } + return XFA_ItemLayoutProcessorResult::Done; + } + + if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) { + if (pProcessor->m_bUseInheriated) { + if (pTrailerLayoutItem) { + AddTrailerBeforeSplit(pProcessor, childSize.height, + pTrailerLayoutItem, false); + } + if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) + AddPendingNode(pProcessor, pOverflowLeaderNode, false); + + pProcessor->m_bUseInheriated = false; + } else { + if (bIsAddTrailerHeight) + childSize.height -= pTrailerLayoutItem->m_sSize.height; + + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, + pOverflowTrailerNode, + pTrailerLayoutItem, pFormNode); + } + } + rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); + *bAddedItemInRow = true; + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); + return eRetValue; + } + + XFA_ItemLayoutProcessorResult eResult; + if (pThis->ProcessKeepForSplit( + pThis, pProcessor, eRetValue, &rgCurLineLayoutItems[uHAlign], + fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY, + bAddedItemInRow, bForceEndPage, &eResult)) { + return eResult; + } + + *bForceEndPage = true; + float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY); + if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { + XFA_ATTRIBUTEENUM eLayout = + pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + if (eLayout == XFA_ATTRIBUTEENUM_Tb && + eRetValue == XFA_ItemLayoutProcessorResult::Done) { + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, + pOverflowTrailerNode, pTrailerLayoutItem, + pFormNode); + rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); + *bAddedItemInRow = true; + if (bTakeSpace) { + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); + } + return XFA_ItemLayoutProcessorResult::PageFullBreak; + } + + CXFA_Node* pTempLeaderNode = nullptr; + CXFA_Node* pTempTrailerNode = nullptr; + if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && + eRetValue != XFA_ItemLayoutProcessorResult::PageFullBreak) { + pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, + pTempTrailerNode, false, true); + } + if (pTrailerLayoutItem && bIsAddTrailerHeight) { + AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem, + bUseInherited); + } else { + pProcessor->SplitLayoutItem(fSplitPos); + } + + if (bUseInherited) { + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, + pOverflowTrailerNode, pTrailerLayoutItem, + pFormNode); + pThis->m_bUseInheriated = true; + } else { + CXFA_LayoutItem* firstChild = pProcessor->m_pLayoutItem->m_pFirstChild; + if (firstChild && !firstChild->m_pNextSibling && + firstChild->m_pFormNode->IsLayoutGeneratedNode()) { + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, + pOverflowTrailerNode, + pTrailerLayoutItem, pFormNode); + } else if (pProcessor->JudgeLeaderOrTrailerForOccur( + pOverflowLeaderNode)) { + AddPendingNode(pProcessor, pOverflowLeaderNode, false); + } + } + + if (pProcessor->m_pLayoutItem->m_pNextSibling) { + childSize = pProcessor->GetCurrentComponentSize(); + rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); + *bAddedItemInRow = true; + if (bTakeSpace) { + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); + } + } + return XFA_ItemLayoutProcessorResult::PageFullBreak; + } + + if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { + childSize = pProcessor->GetCurrentComponentSize(); + if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) { + CXFA_Node* pTempLeaderNode = nullptr; + CXFA_Node* pTempTrailerNode = nullptr; + if (pThis->m_pPageMgr) { + if (!pFormNode && pLayoutContext) + pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; + + pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, + pTempTrailerNode, false, true); + } + if (bUseInherited) { + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, + pOverflowTrailerNode, + pTrailerLayoutItem, pFormNode); + pThis->m_bUseInheriated = true; + } + return XFA_ItemLayoutProcessorResult::PageFullBreak; + } + + rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); + *bAddedItemInRow = true; + if (bTakeSpace) { + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); + } + if (eRetValue == XFA_ItemLayoutProcessorResult::Done) + *bForceEndPage = false; + + return eRetValue; + } + + XFA_ATTRIBUTEENUM eLayout = + pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + if (pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None && + eLayout == XFA_ATTRIBUTEENUM_Tb) { + if (pThis->m_pPageMgr) { + pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, + pOverflowTrailerNode, false, true); + } + if (pTrailerLayoutItem) + AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem, false); + if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) + AddPendingNode(pProcessor, pOverflowLeaderNode, false); + + return XFA_ItemLayoutProcessorResult::PageFullBreak; + } + + if (eRetValue != XFA_ItemLayoutProcessorResult::Done) + return XFA_ItemLayoutProcessorResult::PageFullBreak; + + if (!pFormNode && pLayoutContext) + pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; + if (pThis->m_pPageMgr) { + pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, + pOverflowTrailerNode, false, true); + } + if (bUseInherited) { + pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, + pTrailerLayoutItem, pFormNode); + pThis->m_bUseInheriated = true; + } + return XFA_ItemLayoutProcessorResult::PageFullBreak; +} + +bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, + float fCurVerticalOffset, + float* fProposedSplitPos, + bool* bAppChange, + bool bCalculateMargin) { + CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; + if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION || + *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height - + XFA_LAYOUT_FLOAT_PERCISION) { + return false; + } + + switch (pFormNode->GetIntact()) { + case XFA_ATTRIBUTEENUM_None: { + bool bAnyChanged = false; + CXFA_Document* pDocument = pFormNode->GetDocument(); + CXFA_FFNotify* pNotify = pDocument->GetNotify(); + float fCurTopMargin = 0, fCurBottomMargin = 0; + CXFA_Node* pMarginNode = + pFormNode->GetFirstChildByClass(XFA_Element::Margin); + if (pMarginNode && bCalculateMargin) { + fCurTopMargin = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); + fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) + .ToUnit(XFA_UNIT_Pt); + } + bool bChanged = true; + while (bChanged) { + bChanged = false; + { + float fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset; + if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(), + fRelSplitPos)) { + bAnyChanged = true; + bChanged = true; + *fProposedSplitPos = fCurVerticalOffset + fRelSplitPos; + *bAppChange = true; + if (*fProposedSplitPos <= + fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { + return true; + } + } + } + float fRelSplitPos = *fProposedSplitPos - fCurBottomMargin; + for (CXFA_ContentLayoutItem* pChildItem = + (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; + pChildItem; + pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { + float fChildOffset = + fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; + bool bChange = false; + if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos, + &bChange, bCalculateMargin)) { + if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && + bChange) { + *fProposedSplitPos = fRelSplitPos - fCurTopMargin; + } else { + *fProposedSplitPos = fRelSplitPos + fCurBottomMargin; + } + bAnyChanged = true; + bChanged = true; + if (*fProposedSplitPos <= + fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { + return true; + } + if (bAnyChanged) + break; + } + } + } + return bAnyChanged; + } + case XFA_ATTRIBUTEENUM_ContentArea: + case XFA_ATTRIBUTEENUM_PageArea: { + *fProposedSplitPos = fCurVerticalOffset; + return true; + } + default: + return false; + } +} + +CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode, + const CFX_SizeF& size) { + XFA_ATTRIBUTEENUM eAnchorType = pNode->GetEnum(XFA_ATTRIBUTE_AnchorType); + int32_t nAnchorType = 0; + switch (eAnchorType) { + case XFA_ATTRIBUTEENUM_TopLeft: + nAnchorType = 0; + break; + case XFA_ATTRIBUTEENUM_TopCenter: + nAnchorType = 1; + break; + case XFA_ATTRIBUTEENUM_TopRight: + nAnchorType = 2; + break; + case XFA_ATTRIBUTEENUM_MiddleLeft: + nAnchorType = 3; + break; + case XFA_ATTRIBUTEENUM_MiddleCenter: + nAnchorType = 4; + break; + case XFA_ATTRIBUTEENUM_MiddleRight: + nAnchorType = 5; + break; + case XFA_ATTRIBUTEENUM_BottomLeft: + nAnchorType = 6; + break; + case XFA_ATTRIBUTEENUM_BottomCenter: + nAnchorType = 7; + break; + case XFA_ATTRIBUTEENUM_BottomRight: + nAnchorType = 8; + break; + default: + break; + } + static const uint8_t nNextPos[4][9] = {{0, 1, 2, 3, 4, 5, 6, 7, 8}, + {6, 3, 0, 7, 4, 1, 8, 5, 2}, + {8, 7, 6, 5, 4, 3, 2, 1, 0}, + {2, 5, 8, 1, 4, 7, 0, 3, 6}}; + + CFX_PointF pos(pNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt), + pNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt)); + int32_t nRotate = + FXSYS_round(pNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); + nRotate = XFA_MapRotation(nRotate) / 90; + int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType]; + switch (nAbsoluteAnchorType / 3) { + case 1: + pos.y -= size.height / 2; + break; + case 2: + pos.y -= size.height; + break; + default: + break; + } + switch (nAbsoluteAnchorType % 3) { + case 1: + pos.x -= size.width / 2; + break; + case 2: + pos.x -= size.width; + break; + default: + break; + } + return pos; +} + +} // namespace + +CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, + CXFA_LayoutPageMgr* pPageMgr) + : m_pFormNode(pNode), + m_pLayoutItem(nullptr), + m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), + m_fUsedSize(0), + m_pPageMgr(pPageMgr), + m_bBreakPending(true), + m_fLastRowWidth(0), + m_fLastRowY(0), + m_bUseInheriated(false), + m_ePreProcessRs(XFA_ItemLayoutProcessorResult::Done), + m_bKeepBreakFinish(false), + m_bIsProcessKeep(false), + m_pKeepHeadNode(nullptr), + m_pKeepTailNode(nullptr), + m_pOldLayoutItem(nullptr), + m_pCurChildPreprocessor(nullptr), + m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages::None), + m_fWidthLimite(0), + m_bHasAvailHeight(true) { + ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || + m_pFormNode->GetElementType() == XFA_Element::Form)); + m_pOldLayoutItem = + (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); +} + +CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} + +CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( + CXFA_Node* pFormNode) { + if (!pFormNode) + return nullptr; + + CXFA_ContentLayoutItem* pLayoutItem = nullptr; + if (m_pOldLayoutItem) { + pLayoutItem = m_pOldLayoutItem; + m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; + return pLayoutItem; + } + pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument() + ->GetNotify() + ->OnCreateLayoutItem(pFormNode); + CXFA_ContentLayoutItem* pPrevLayoutItem = + (CXFA_ContentLayoutItem*)pFormNode->GetUserData(XFA_LAYOUTITEMKEY); + if (pPrevLayoutItem) { + while (pPrevLayoutItem->m_pNext) + pPrevLayoutItem = pPrevLayoutItem->m_pNext; + + pPrevLayoutItem->m_pNext = pLayoutItem; + pLayoutItem->m_pPrev = pPrevLayoutItem; + } else { + pFormNode->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem); + } + return pLayoutItem; +} + +float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) { + ASSERT(m_pLayoutItem); + XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + bool bCalculateMargin = eLayout != XFA_ATTRIBUTEENUM_Position; + while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { + bool bAppChange = false; + if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, &fProposedSplitPos, + &bAppChange, bCalculateMargin)) { + break; + } + } + return fProposedSplitPos; +} + +void CXFA_ItemLayoutProcessor::SplitLayoutItem( + CXFA_ContentLayoutItem* pLayoutItem, + CXFA_ContentLayoutItem* pSecondParent, + float fSplitPos) { + float fCurTopMargin = 0, fCurBottomMargin = 0; + XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + bool bCalculateMargin = true; + if (eLayout == XFA_ATTRIBUTEENUM_Position) + bCalculateMargin = false; + + CXFA_Node* pMarginNode = + pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); + if (pMarginNode && bCalculateMargin) { + fCurTopMargin = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); + fCurBottomMargin = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); + } + + CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr; + if (m_pCurChildPreprocessor && + m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { + pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( + pLayoutItem->m_pFormNode); + } else { + pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode); + } + pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x; + pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width; + pSecondLayoutItem->m_sPos.y = 0; + pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos; + pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height; + if (pLayoutItem->m_pFirstChild) + pSecondLayoutItem->m_sSize.height += fCurTopMargin; + + if (pSecondParent) { + pSecondParent->AddChild(pSecondLayoutItem); + if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) { + pSecondParent->m_sSize.height += fCurTopMargin; + CXFA_ContentLayoutItem* pParentItem = + (CXFA_ContentLayoutItem*)pSecondParent->m_pParent; + while (pParentItem) { + pParentItem->m_sSize.height += fCurTopMargin; + pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; + } + } + } else { + pSecondLayoutItem->m_pParent = pLayoutItem->m_pParent; + pSecondLayoutItem->m_pNextSibling = pLayoutItem->m_pNextSibling; + pLayoutItem->m_pNextSibling = pSecondLayoutItem; + } + + CXFA_ContentLayoutItem* pChildren = + (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; + pLayoutItem->m_pFirstChild = nullptr; + + float lHeightForKeep = 0; + float fAddMarginHeight = 0; + std::vector keepLayoutItems; + for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; + pChildItem; pChildItem = pChildNext) { + pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; + pChildItem->m_pNextSibling = nullptr; + if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + + XFA_LAYOUT_FLOAT_PERCISION) { + if (!ExistContainerKeep(pChildItem->m_pFormNode, true)) { + pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin; + pChildItem->m_sPos.y += lHeightForKeep; + pChildItem->m_sPos.y += fAddMarginHeight; + pSecondLayoutItem->AddChild(pChildItem); + continue; + } + if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) { + for (auto* pPreItem : keepLayoutItems) { + pLayoutItem->RemoveChild(pPreItem); + pPreItem->m_sPos.y -= fSplitPos; + if (pPreItem->m_sPos.y < 0) + pPreItem->m_sPos.y = 0; + if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) { + pPreItem->m_sPos.y = lHeightForKeep; + lHeightForKeep += pPreItem->m_sSize.height; + pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height; + if (pSecondParent) + pSecondParent->m_sSize.height += pPreItem->m_sSize.height; + } + pSecondLayoutItem->AddChild(pPreItem); + } + } + pChildItem->m_sPos.y -= fSplitPos; + pChildItem->m_sPos.y += lHeightForKeep; + pChildItem->m_sPos.y += fAddMarginHeight; + pSecondLayoutItem->AddChild(pChildItem); + continue; + } + if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >= + fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y + + pChildItem->m_sSize.height) { + pLayoutItem->AddChild(pChildItem); + if (ExistContainerKeep(pChildItem->m_pFormNode, false)) + keepLayoutItems.push_back(pChildItem); + else + keepLayoutItems.clear(); + continue; + } + + float fOldHeight = pSecondLayoutItem->m_sSize.height; + SplitLayoutItem( + pChildItem, pSecondLayoutItem, + fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); + fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight; + pLayoutItem->AddChild(pChildItem); + } +} + +void CXFA_ItemLayoutProcessor::SplitLayoutItem(float fSplitPos) { + ASSERT(m_pLayoutItem); + SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos); +} + +CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { + CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem; + if (pLayoutItem) { + m_pLayoutItem = + static_cast(pLayoutItem->m_pNextSibling); + pLayoutItem->m_pNextSibling = nullptr; + } + + if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done || + !ToContentLayoutItem(m_pOldLayoutItem)) { + return pLayoutItem; + } + + if (m_pOldLayoutItem->m_pPrev) + m_pOldLayoutItem->m_pPrev->m_pNext = nullptr; + + CXFA_FFNotify* pNotify = + m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify(); + CXFA_LayoutProcessor* pDocLayout = + m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); + CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; + while (pOldLayoutItem) { + CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext; + pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem); + if (pOldLayoutItem->m_pParent) + pOldLayoutItem->m_pParent->RemoveChild(pOldLayoutItem); + + delete pOldLayoutItem; + pOldLayoutItem = pNextOldLayoutItem; + } + m_pOldLayoutItem = nullptr; + return pLayoutItem; +} + +void CXFA_ItemLayoutProcessor::GotoNextContainerNode( + CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node* pParentContainer, + bool bUsePageBreak) { + CXFA_Node* pEntireContainer = pParentContainer; + CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE; + switch (nCurStage) { + case XFA_ItemLayoutProcessorStages::BreakBefore: + case XFA_ItemLayoutProcessorStages::BreakAfter: { + pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent); + break; + } + case XFA_ItemLayoutProcessorStages::Keep: + case XFA_ItemLayoutProcessorStages::Container: + pChildContainer = pCurActionNode; + break; + default: + pChildContainer = XFA_LAYOUT_INVALIDNODE; + break; + } + + switch (nCurStage) { + case XFA_ItemLayoutProcessorStages::Keep: { + CXFA_Node* pBreakAfterNode = + pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); + if (!m_bKeepBreakFinish && + FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false)) { + return; + } + goto CheckNextChildContainer; + } + case XFA_ItemLayoutProcessorStages::None: { + pCurActionNode = XFA_LAYOUT_INVALIDNODE; + case XFA_ItemLayoutProcessorStages::BookendLeader: + for (CXFA_Node* pBookendNode = + pCurActionNode == XFA_LAYOUT_INVALIDNODE + ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) + : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); + pBookendNode; pBookendNode = pBookendNode->GetNodeItem( + XFA_NODEITEM_NextSibling)) { + switch (pBookendNode->GetElementType()) { + case XFA_Element::Bookend: + case XFA_Element::Break: + pCurActionNode = pBookendNode; + nCurStage = XFA_ItemLayoutProcessorStages::BookendLeader; + return; + default: + break; + } + } + } + { + pCurActionNode = XFA_LAYOUT_INVALIDNODE; + case XFA_ItemLayoutProcessorStages::BreakBefore: + if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) { + CXFA_Node* pBreakBeforeNode = + pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); + if (!m_bKeepBreakFinish && + FindBreakNode(pBreakBeforeNode, pCurActionNode, &nCurStage, + true)) { + return; + } + if (m_bIsProcessKeep) { + if (ProcessKeepNodesForBreakBefore(pCurActionNode, nCurStage, + pChildContainer)) { + return; + } + goto CheckNextChildContainer; + } + pCurActionNode = pChildContainer; + nCurStage = XFA_ItemLayoutProcessorStages::Container; + return; + } + goto CheckNextChildContainer; + } + case XFA_ItemLayoutProcessorStages::Container: { + pCurActionNode = XFA_LAYOUT_INVALIDNODE; + case XFA_ItemLayoutProcessorStages::BreakAfter: { + if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) { + CXFA_Node* pBreakAfterNode = + pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); + if (!m_bKeepBreakFinish && + FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, + false)) { + return; + } + } else { + CXFA_Node* pBreakAfterNode = + pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); + if (FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, + false)) { + return; + } + } + goto CheckNextChildContainer; + } + } + + CheckNextChildContainer : { + CXFA_Node* pNextChildContainer = + pChildContainer == XFA_LAYOUT_INVALIDNODE + ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild, + XFA_ObjectType::ContainerNode) + : pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, + XFA_ObjectType::ContainerNode); + while (pNextChildContainer && + pNextChildContainer->IsLayoutGeneratedNode()) { + CXFA_Node* pSaveNode = pNextChildContainer; + pNextChildContainer = pNextChildContainer->GetNodeItem( + XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode); + if (pSaveNode->IsUnusedNode()) + DeleteLayoutGeneratedNode(pSaveNode); + } + if (!pNextChildContainer) + goto NoMoreChildContainer; + + bool bLastKeep = false; + if (ProcessKeepNodesForCheckNext(pCurActionNode, nCurStage, + pNextChildContainer, bLastKeep)) { + return; + } + if (!m_bKeepBreakFinish && !bLastKeep && + FindBreakNode( + pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild), + pCurActionNode, &nCurStage, true)) { + return; + } + pCurActionNode = pNextChildContainer; + if (m_bIsProcessKeep) + nCurStage = XFA_ItemLayoutProcessorStages::Keep; + else + nCurStage = XFA_ItemLayoutProcessorStages::Container; + return; + } + + NoMoreChildContainer : { + pCurActionNode = XFA_LAYOUT_INVALIDNODE; + case XFA_ItemLayoutProcessorStages::BookendTrailer: + for (CXFA_Node* pBookendNode = + pCurActionNode == XFA_LAYOUT_INVALIDNODE + ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) + : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); + pBookendNode; pBookendNode = pBookendNode->GetNodeItem( + XFA_NODEITEM_NextSibling)) { + switch (pBookendNode->GetElementType()) { + case XFA_Element::Bookend: + case XFA_Element::Break: + pCurActionNode = pBookendNode; + nCurStage = XFA_ItemLayoutProcessorStages::BookendTrailer; + return; + default: + break; + } + } + } + default: + pCurActionNode = nullptr; + nCurStage = XFA_ItemLayoutProcessorStages::Done; + } +} + +bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( + CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node*& pNextContainer, + bool& bLastKeepNode) { + const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; + bool bNextKeep = false; + if (ExistContainerKeep(pNextContainer, false)) + bNextKeep = true; + + if (bNextKeep && !bCanSplit) { + if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { + m_pKeepHeadNode = pNextContainer; + m_bIsProcessKeep = true; + } + return false; + } + + if (m_bIsProcessKeep && m_pKeepHeadNode) { + m_pKeepTailNode = pNextContainer; + if (!m_bKeepBreakFinish && + FindBreakNode(pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild), + pCurActionNode, &nCurStage, true)) { + return true; + } + + pNextContainer = m_pKeepHeadNode; + m_bKeepBreakFinish = true; + m_pKeepHeadNode = nullptr; + m_pKeepTailNode = nullptr; + m_bIsProcessKeep = false; + } else { + if (m_bKeepBreakFinish) + bLastKeepNode = true; + m_bKeepBreakFinish = false; + } + + return false; +} + +bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( + CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node* pContainerNode) { + if (m_pKeepTailNode == pContainerNode) { + pCurActionNode = m_pKeepHeadNode; + m_bKeepBreakFinish = true; + m_pKeepHeadNode = nullptr; + m_pKeepTailNode = nullptr; + m_bIsProcessKeep = false; + nCurStage = XFA_ItemLayoutProcessorStages::Container; + return true; + } + + CXFA_Node* pBreakAfterNode = + pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild); + return FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false); +} + +bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) { + XFA_ATTRIBUTEENUM ePresence = pNode->GetEnum(XFA_ATTRIBUTE_Presence); + return ePresence == XFA_ATTRIBUTEENUM_Visible || + ePresence == XFA_ATTRIBUTEENUM_Invisible; +} + +bool CXFA_ItemLayoutProcessor::IncrementRelayoutNode( + CXFA_LayoutProcessor* pLayoutProcessor, + CXFA_Node* pNode, + CXFA_Node* pParentNode) { + return false; +} + +void CXFA_ItemLayoutProcessor::DoLayoutPageArea( + CXFA_ContainerLayoutItem* pPageAreaLayoutItem) { + CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode; + CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; + XFA_ItemLayoutProcessorStages nCurChildNodeStage = + XFA_ItemLayoutProcessorStages::None; + CXFA_LayoutItem* pBeforeItem = nullptr; + for (GotoNextContainerNode(pCurChildNode, nCurChildNodeStage, pFormNode, + false); + pCurChildNode; GotoNextContainerNode(pCurChildNode, nCurChildNodeStage, + pFormNode, false)) { + if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container) + continue; + if (pCurChildNode->GetElementType() == XFA_Element::Variables) + continue; + + auto pProcessor = + pdfium::MakeUnique(pCurChildNode, nullptr); + pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr); + if (!pProcessor->HasLayoutItem()) + continue; + + pProcessor->SetCurrentComponentPos(CalculatePositionedContainerPos( + pCurChildNode, pProcessor->GetCurrentComponentSize())); + CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); + if (!pBeforeItem) + pPageAreaLayoutItem->AddHeadChild(pProcessItem); + else + pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); + + pBeforeItem = pProcessItem; + } + + pBeforeItem = nullptr; + CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; + while (pLayoutItem) { + if (!pLayoutItem->IsContentLayoutItem() || + pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) { + pLayoutItem = pLayoutItem->m_pNextSibling; + continue; + } + if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) + continue; + + CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; + pPageAreaLayoutItem->RemoveChild(pLayoutItem); + if (!pBeforeItem) + pPageAreaLayoutItem->AddHeadChild(pLayoutItem); + else + pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); + + pBeforeItem = pLayoutItem; + pLayoutItem = pNextLayoutItem; + } +} + +void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( + CXFA_LayoutContext* pContext) { + if (m_pLayoutItem) + return; + + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); + bool bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) != + XFA_ATTRIBUTEENUM_Position); + bool bContainerWidthAutoSize = true; + bool bContainerHeightAutoSize = true; + CFX_SizeF containerSize = CalculateContainerSpecifiedSize( + m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); + + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + float fHiddenContentCalculatedWidth = 0; + float fHiddenContentCalculatedHeight = 0; + if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { + GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, + false); + } + + int32_t iColIndex = 0; + for (; m_pCurChildNode; GotoNextContainerNode( + m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) { + if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container) + continue; + if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) + continue; + + auto pProcessor = pdfium::MakeUnique( + m_pCurChildNode, m_pPageMgr); + if (pContext && pContext->m_prgSpecifiedColumnWidths) { + int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); + if (iColSpan <= pdfium::CollectionSize( + *pContext->m_prgSpecifiedColumnWidths) - + iColIndex) { + pContext->m_fCurColumnWidth = 0; + pContext->m_bCurColumnWidthAvaiable = true; + if (iColSpan == -1) { + iColSpan = pdfium::CollectionSize( + *pContext->m_prgSpecifiedColumnWidths); + } + for (int32_t i = 0; iColIndex + i < iColSpan; ++i) { + pContext->m_fCurColumnWidth += + (*pContext->m_prgSpecifiedColumnWidths)[iColIndex + i]; + } + if (pContext->m_fCurColumnWidth == 0) + pContext->m_bCurColumnWidthAvaiable = false; + + iColIndex += iColSpan >= 0 ? iColSpan : 0; + } + } + + pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pContext); + if (!pProcessor->HasLayoutItem()) + continue; + + CFX_SizeF size = pProcessor->GetCurrentComponentSize(); + bool bChangeParentSize = false; + if (XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) + bChangeParentSize = true; + + CFX_PointF absolutePos; + if (!bIgnoreXY) + absolutePos = CalculatePositionedContainerPos(m_pCurChildNode, size); + + pProcessor->SetCurrentComponentPos(absolutePos); + if (bContainerWidthAutoSize) { + float fChildSuppliedWidth = absolutePos.x + size.width; + if (bChangeParentSize) { + fContentCalculatedWidth = + std::max(fContentCalculatedWidth, fChildSuppliedWidth); + } else { + if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && + m_pCurChildNode->GetElementType() != XFA_Element::Subform) { + fHiddenContentCalculatedWidth = fChildSuppliedWidth; + } + } + } + + if (bContainerHeightAutoSize) { + float fChildSuppliedHeight = absolutePos.y + size.height; + if (bChangeParentSize) { + fContentCalculatedHeight = + std::max(fContentCalculatedHeight, fChildSuppliedHeight); + } else { + if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && + m_pCurChildNode->GetElementType() != XFA_Element::Subform) { + fHiddenContentCalculatedHeight = fChildSuppliedHeight; + } + } + } + m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); + } + + XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode(); + if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207) + fContentCalculatedWidth = fHiddenContentCalculatedWidth; + if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207) + fContentCalculatedHeight = fHiddenContentCalculatedHeight; + + containerSize = CalculateContainerComponentSizeFromContentSize( + m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, + bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); + SetCurrentComponentSize(containerSize); +} + +void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { + if (m_pLayoutItem) + return; + if (!pLayoutNode) + pLayoutNode = m_pFormNode; + + ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); + + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); + bool bContainerWidthAutoSize = true; + bool bContainerHeightAutoSize = true; + CFX_SizeF containerSize = CalculateContainerSpecifiedSize( + m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + CXFA_Node* pMarginNode = + m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); + float fLeftInset = 0; + float fRightInset = 0; + if (pMarginNode) { + fLeftInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); + fRightInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); + } + + float fContentWidthLimit = + bContainerWidthAutoSize ? FLT_MAX + : containerSize.width - fLeftInset - fRightInset; + CFX_WideStringC wsColumnWidths; + if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { + auto widths = SeparateStringW(wsColumnWidths.c_str(), + wsColumnWidths.GetLength(), L' '); + for (auto& width : widths) { + width.TrimLeft(L' '); + if (width.IsEmpty()) + continue; + + m_rgSpecifiedColumnWidths.push_back( + CXFA_Measurement(width.AsStringC()).ToUnit(XFA_UNIT_Pt)); + } + } + + int32_t iSpecifiedColumnCount = + pdfium::CollectionSize(m_rgSpecifiedColumnWidths); + CXFA_LayoutContext layoutContext; + layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; + CXFA_LayoutContext* pLayoutContext = + iSpecifiedColumnCount > 0 ? &layoutContext : nullptr; + if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { + GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, + false); + } + + for (; m_pCurChildNode; GotoNextContainerNode( + m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) { + layoutContext.m_bCurColumnWidthAvaiable = false; + layoutContext.m_fCurColumnWidth = 0; + if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container) + continue; + + auto pProcessor = pdfium::MakeUnique( + m_pCurChildNode, m_pPageMgr); + pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pLayoutContext); + if (!pProcessor->HasLayoutItem()) + continue; + + m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); + } + + int32_t iRowCount = 0; + int32_t iColCount = 0; + { + std::vector rgRowItems; + std::vector rgRowItemsSpan; + std::vector rgRowItemsWidth; + for (auto* pLayoutChild = + static_cast(m_pLayoutItem->m_pFirstChild); + pLayoutChild; pLayoutChild = static_cast( + pLayoutChild->m_pNextSibling)) { + if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform) + continue; + if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) + continue; + + XFA_ATTRIBUTEENUM eLayout = + pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + if (eLayout != XFA_ATTRIBUTEENUM_Row && + eLayout != XFA_ATTRIBUTEENUM_Rl_row) { + continue; + } + if (CXFA_ContentLayoutItem* pRowLayoutCell = + (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) { + rgRowItems.push_back(pRowLayoutCell); + int32_t iColSpan = + pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); + rgRowItemsSpan.push_back(iColSpan); + rgRowItemsWidth.push_back(pRowLayoutCell->m_sSize.width); + } + } + + iRowCount = pdfium::CollectionSize(rgRowItems); + iColCount = 0; + bool bMoreColumns = true; + while (bMoreColumns) { + bMoreColumns = false; + bool bAutoCol = false; + for (int32_t i = 0; i < iRowCount; i++) { + while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || + !XFA_ItemLayoutProcessor_IsTakingSpace( + rgRowItems[i]->m_pFormNode))) { + CXFA_ContentLayoutItem* pNewCell = + (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; + if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( + rgRowItems[i]->m_pFormNode)) { + pNewCell = nullptr; + } + rgRowItems[i] = pNewCell; + rgRowItemsSpan[i] = + pNewCell + ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) + : 0; + rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0; + } + CXFA_ContentLayoutItem* pCell = rgRowItems[i]; + if (!pCell) + continue; + + bMoreColumns = true; + if (rgRowItemsSpan[i] != 1) + continue; + + if (iColCount >= iSpecifiedColumnCount) { + int32_t c = iColCount + 1 - pdfium::CollectionSize( + m_rgSpecifiedColumnWidths); + for (int32_t j = 0; j < c; j++) + m_rgSpecifiedColumnWidths.push_back(0); + } + if (m_rgSpecifiedColumnWidths[iColCount] < XFA_LAYOUT_FLOAT_PERCISION) + bAutoCol = true; + if (bAutoCol && + m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) { + m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i]; + } + } + + if (!bMoreColumns) + continue; + + float fFinalColumnWidth = 0.0f; + if (pdfium::IndexInBounds(m_rgSpecifiedColumnWidths, iColCount)) + fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount]; + + for (int32_t i = 0; i < iRowCount; ++i) { + if (!rgRowItems[i]) + continue; + --rgRowItemsSpan[i]; + rgRowItemsWidth[i] -= fFinalColumnWidth; + } + ++iColCount; + } + } + + float fCurrentRowY = 0; + for (CXFA_ContentLayoutItem* pLayoutChild = + (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; + pLayoutChild; + pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { + if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) + continue; + + if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) { + XFA_ATTRIBUTEENUM eSubformLayout = + pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || + eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) { + RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths, + eSubformLayout); + } + } + + pLayoutChild->m_sPos.y = fCurrentRowY; + if (bContainerWidthAutoSize) { + pLayoutChild->m_sPos.x = 0; + } else { + switch (pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { + case XFA_ATTRIBUTEENUM_Center: + pLayoutChild->m_sPos.x = + (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2; + break; + case XFA_ATTRIBUTEENUM_Right: + pLayoutChild->m_sPos.x = + fContentWidthLimit - pLayoutChild->m_sSize.width; + break; + case XFA_ATTRIBUTEENUM_Left: + default: + pLayoutChild->m_sPos.x = 0; + break; + } + } + + if (bContainerWidthAutoSize) { + float fChildSuppliedWidth = + pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width; + if (fContentWidthLimit < FLT_MAX && + fContentWidthLimit > fChildSuppliedWidth) { + fChildSuppliedWidth = fContentWidthLimit; + } + fContentCalculatedWidth = + std::max(fContentCalculatedWidth, fChildSuppliedWidth); + } + fCurrentRowY += pLayoutChild->m_sSize.height; + } + + if (bContainerHeightAutoSize) + fContentCalculatedHeight = std::max(fContentCalculatedHeight, fCurrentRowY); + + containerSize = CalculateContainerComponentSizeFromContentSize( + m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, + bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); + SetCurrentComponentSize(containerSize); +} + +bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( + CXFA_ContentLayoutItem* pTrailerItem) { + if (!pTrailerItem) + return false; + + float fWidth = pTrailerItem->m_sSize.width; + XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); + return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth; +} + +float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { + if (m_arrayKeepItems.empty()) + return 0; + + if (!m_pLayoutItem) { + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); + m_pLayoutItem->m_sSize.clear(); + } + + float fTotalHeight = 0; + for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend(); + iter++) { + AddLeaderAfterSplit(this, *iter); + fTotalHeight += (*iter)->m_sSize.height; + } + m_arrayKeepItems.clear(); + + return fTotalHeight; +} + +bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( + CXFA_ItemLayoutProcessor* pParentProcessor, + CXFA_ItemLayoutProcessor* pChildProcessor, + XFA_ItemLayoutProcessorResult eRetValue, + std::vector* rgCurLineLayoutItem, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, + float* fContentCurRowY, + bool* bAddedItemInRow, + bool* bForceEndPage, + XFA_ItemLayoutProcessorResult* result) { + if (!pParentProcessor || !pChildProcessor) + return false; + + if (pParentProcessor->m_pCurChildNode->GetIntact() == + XFA_ATTRIBUTEENUM_None && + pChildProcessor->m_bHasAvailHeight) + return false; + + if (!ExistContainerKeep(pParentProcessor->m_pCurChildNode, true)) + return false; + + CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize(); + std::vector keepLayoutItems; + if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, + childSize.height, &keepLayoutItems)) { + m_arrayKeepItems.clear(); + + for (auto* item : keepLayoutItems) { + pParentProcessor->m_pLayoutItem->RemoveChild(item); + *fContentCurRowY -= item->m_sSize.height; + m_arrayKeepItems.push_back(item); + } + *bAddedItemInRow = true; + *bForceEndPage = true; + *result = XFA_ItemLayoutProcessorResult::PageFullBreak; + return true; + } + + rgCurLineLayoutItem->push_back(pChildProcessor->ExtractLayoutItem()); + *bAddedItemInRow = true; + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); + *result = eRetValue; + + return true; +} + +bool CXFA_ItemLayoutProcessor::JudgePutNextPage( + CXFA_ContentLayoutItem* pParentLayoutItem, + float fChildHeight, + std::vector* pKeepItems) { + if (!pParentLayoutItem) + return false; + + float fItemsHeight = 0; + for (CXFA_ContentLayoutItem* pChildLayoutItem = + (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; + pChildLayoutItem; + pChildLayoutItem = + (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { + if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) { + pKeepItems->push_back(pChildLayoutItem); + fItemsHeight += pChildLayoutItem->m_sSize.height; + } else { + pKeepItems->clear(); + fItemsHeight = 0; + } + } + fItemsHeight += fChildHeight; + return m_pPageMgr->GetNextAvailContentHeight(fItemsHeight); +} + +void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) { + if (!pFormNode) + return; + + CXFA_NodeIteratorTemplate sIterator( + pFormNode); + for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; + pNode = sIterator.MoveToNext()) { + if (pNode->IsContainerNode()) { + CXFA_Node* pBindNode = pNode->GetBindData(); + if (pBindNode) { + pBindNode->RemoveBindItem(pNode); + pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + } + } + pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); + } +} + +void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( + CXFA_Node* pLeaderNode, + CXFA_Node* pTrailerNode, + CXFA_ContentLayoutItem* pTrailerItem, + CXFA_Node* pFormNode) { + ProcessUnUseBinds(pLeaderNode); + ProcessUnUseBinds(pTrailerNode); + if (!pFormNode) + return; + + if (pFormNode->GetElementType() == XFA_Element::Overflow || + pFormNode->GetElementType() == XFA_Element::Break) { + pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); + } + if (pLeaderNode && pFormNode) + pFormNode->RemoveChild(pLeaderNode); + if (pTrailerNode && pFormNode) + pFormNode->RemoveChild(pTrailerNode); + if (pTrailerItem) + XFA_ReleaseLayoutItem(pTrailerItem); +} + +XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( + bool bUseBreakControl, + XFA_ATTRIBUTEENUM eFlowStrategy, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext, + bool bRootForceTb) { + m_bHasAvailHeight = true; + bool bBreakDone = false; + bool bContainerWidthAutoSize = true; + bool bContainerHeightAutoSize = true; + bool bForceEndPage = false; + bool bIsManualBreak = false; + if (m_pCurChildPreprocessor) { + m_pCurChildPreprocessor->m_ePreProcessRs = + XFA_ItemLayoutProcessorResult::Done; + } + + CFX_SizeF containerSize = CalculateContainerSpecifiedSize( + m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); + if (pContext && pContext->m_bCurColumnWidthAvaiable) { + bContainerWidthAutoSize = false; + containerSize.width = pContext->m_fCurColumnWidth; + } + if (!bContainerHeightAutoSize) + containerSize.height -= m_fUsedSize; + + if (!bContainerHeightAutoSize) { + CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent); + bool bFocrTb = false; + if (pParentNode && + GetLayout(pParentNode, &bFocrTb) == XFA_ATTRIBUTEENUM_Row) { + CXFA_Node* pChildContainer = m_pFormNode->GetNodeItem( + XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); + if (pChildContainer && + pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, + XFA_ObjectType::ContainerNode)) { + containerSize.height = 0; + bContainerHeightAutoSize = true; + } + } + } + + CXFA_Node* pMarginNode = + m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; + if (pMarginNode) { + fLeftInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); + fTopInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); + fRightInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); + fBottomInset = + pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); + } + float fContentWidthLimit = + bContainerWidthAutoSize ? FLT_MAX + : containerSize.width - fLeftInset - fRightInset; + float fContentCalculatedWidth = 0; + float fContentCalculatedHeight = 0; + float fAvailHeight = fHeightLimit - fTopInset - fBottomInset; + if (fAvailHeight < 0) + m_bHasAvailHeight = false; + + fRealHeight = fRealHeight - fTopInset - fBottomInset; + float fContentCurRowY = 0; + CXFA_ContentLayoutItem* pLayoutChild = nullptr; + if (m_pLayoutItem) { + if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done && + eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { + pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; + for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; + pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { + if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y) + pLayoutChild = pLayoutNext; + } + } + + for (CXFA_ContentLayoutItem* pLayoutTempChild = + (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; + pLayoutTempChild != pLayoutChild; + pLayoutTempChild = + (CXFA_ContentLayoutItem*)pLayoutTempChild->m_pNextSibling) { + if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutTempChild->m_pFormNode)) + continue; + + fContentCalculatedWidth = std::max( + fContentCalculatedWidth, + pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.width); + fContentCalculatedHeight = std::max( + fContentCalculatedHeight, + pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.height); + } + + if (pLayoutChild) + fContentCurRowY = pLayoutChild->m_sPos.y; + else + fContentCurRowY = fContentCalculatedHeight; + } + + fContentCurRowY += InsertKeepLayoutItems(); + if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None) { + GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, + true); + } + + fContentCurRowY += InsertPendingItems(this, m_pFormNode); + if (m_pCurChildPreprocessor && + m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Container) { + if (ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) { + m_pKeepHeadNode = m_pCurChildNode; + m_bIsProcessKeep = true; + m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Keep; + } + } + + while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done) { + float fContentCurRowHeight = 0; + float fContentCurRowAvailWidth = fContentWidthLimit; + m_fWidthLimite = fContentCurRowAvailWidth; + std::vector rgCurLineLayoutItems[3]; + uint8_t uCurHAlignState = + (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2); + if (pLayoutChild) { + for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; + pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { + if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor && + m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) { + pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem; + m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext; + break; + } + uint8_t uHAlign = HAlignEnumToInt( + pLayoutNext->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)); + rgCurLineLayoutItems[uHAlign].push_back(pLayoutNext); + if (eFlowStrategy == XFA_ATTRIBUTEENUM_Lr_tb) { + if (uHAlign > uCurHAlignState) + uCurHAlignState = uHAlign; + } else if (uHAlign < uCurHAlignState) { + uCurHAlignState = uHAlign; + } + if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) { + if (pLayoutNext->m_sSize.height > fContentCurRowHeight) + fContentCurRowHeight = pLayoutNext->m_sSize.height; + fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width; + } + } + + if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild == + pLayoutChild) { + m_pLayoutItem->m_pFirstChild = nullptr; + } else { + CXFA_ContentLayoutItem* pLayoutNext = + (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; + for (; pLayoutNext; + pLayoutNext = + (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { + if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling == + pLayoutChild) { + pLayoutNext->m_pNextSibling = nullptr; + break; + } + } + } + + CXFA_ContentLayoutItem* pLayoutNextTemp = + (CXFA_ContentLayoutItem*)pLayoutChild; + while (pLayoutNextTemp) { + pLayoutNextTemp->m_pParent = nullptr; + CXFA_ContentLayoutItem* pSaveLayoutNext = + (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; + pLayoutNextTemp->m_pNextSibling = nullptr; + pLayoutNextTemp = pSaveLayoutNext; + } + pLayoutChild = nullptr; + } + + while (m_pCurChildNode) { + std::unique_ptr pProcessor; + bool bAddedItemInRow = false; + fContentCurRowY += InsertPendingItems(this, m_pFormNode); + switch (m_nCurChildNodeStage) { + case XFA_ItemLayoutProcessorStages::Keep: + case XFA_ItemLayoutProcessorStages::None: + break; + case XFA_ItemLayoutProcessorStages::BreakBefore: { + for (auto* item : m_arrayKeepItems) { + m_pLayoutItem->RemoveChild(item); + fContentCalculatedHeight -= item->m_sSize.height; + } + + CXFA_Node* pLeaderNode = nullptr; + CXFA_Node* pTrailerNode = nullptr; + bool bCreatePage = false; + if (!bUseBreakControl || !m_pPageMgr || + !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, true, + pLeaderNode, pTrailerNode, + bCreatePage) || + m_pFormNode->GetElementType() == XFA_Element::Form || + !bCreatePage) { + break; + } + + if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) + AddPendingNode(this, pLeaderNode, true); + + if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { + if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) + ->GetElementType() == XFA_Element::Form && + !m_pLayoutItem) { + AddPendingNode(this, pTrailerNode, true); + } else { + auto pTempProcessor = + pdfium::MakeUnique(pTrailerNode, + nullptr); + InsertFlowedItem( + this, pTempProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, + &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, + FLT_MAX, fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, false); + } + } + GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, + m_pFormNode, true); + bForceEndPage = true; + bIsManualBreak = true; + goto SuspendAndCreateNewRow; + } + case XFA_ItemLayoutProcessorStages::BreakAfter: { + CXFA_Node* pLeaderNode = nullptr; + CXFA_Node* pTrailerNode = nullptr; + bool bCreatePage = false; + if (!bUseBreakControl || !m_pPageMgr || + !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, false, + pLeaderNode, pTrailerNode, + bCreatePage) || + m_pFormNode->GetElementType() == XFA_Element::Form) { + break; + } + + if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { + auto pTempProcessor = pdfium::MakeUnique( + pTrailerNode, nullptr); + InsertFlowedItem( + this, pTempProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, + &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, + fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, + &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, + pContext, false); + } + if (!bCreatePage) { + if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { + CalculateRowChildPosition( + rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize, + bContainerWidthAutoSize, &fContentCalculatedWidth, + &fContentCalculatedHeight, &fContentCurRowY, + fContentCurRowHeight, fContentWidthLimit, false); + rgCurLineLayoutItems->clear(); + auto pTempProcessor = + pdfium::MakeUnique(pLeaderNode, + nullptr); + InsertFlowedItem( + this, pTempProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, + &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, + FLT_MAX, fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, false); + } + } else { + if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) + AddPendingNode(this, pLeaderNode, true); + } + + GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, + m_pFormNode, true); + if (bCreatePage) { + bForceEndPage = true; + bIsManualBreak = true; + if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done) + bBreakDone = true; + } + goto SuspendAndCreateNewRow; + } + case XFA_ItemLayoutProcessorStages::BookendLeader: { + CXFA_Node* pLeaderNode = nullptr; + if (m_pCurChildPreprocessor) { + pProcessor.reset(m_pCurChildPreprocessor); + m_pCurChildPreprocessor = nullptr; + } else if (m_pPageMgr && + m_pPageMgr->ProcessBookendLeaderOrTrailer( + m_pCurChildNode, true, pLeaderNode)) { + pProcessor = pdfium::MakeUnique( + pLeaderNode, m_pPageMgr); + } + + if (pProcessor) { + if (InsertFlowedItem( + this, pProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, + eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, + bUseBreakControl, fAvailHeight, fRealHeight, + fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, + false) != XFA_ItemLayoutProcessorResult::Done) { + goto SuspendAndCreateNewRow; + } else { + pProcessor.reset(); + } + } + break; + } + case XFA_ItemLayoutProcessorStages::BookendTrailer: { + CXFA_Node* pTrailerNode = nullptr; + if (m_pCurChildPreprocessor) { + pProcessor.reset(m_pCurChildPreprocessor); + m_pCurChildPreprocessor = nullptr; + } else if (m_pPageMgr && + m_pPageMgr->ProcessBookendLeaderOrTrailer( + m_pCurChildNode, false, pTrailerNode)) { + pProcessor = pdfium::MakeUnique( + pTrailerNode, m_pPageMgr); + } + if (pProcessor) { + if (InsertFlowedItem( + this, pProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, + eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, + bUseBreakControl, fAvailHeight, fRealHeight, + fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, + false) != XFA_ItemLayoutProcessorResult::Done) { + goto SuspendAndCreateNewRow; + } else { + pProcessor.reset(); + } + } + break; + } + case XFA_ItemLayoutProcessorStages::Container: { + ASSERT(m_pCurChildNode->IsContainerNode()); + if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) + break; + if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && + XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { + bForceEndPage = true; + goto SuspendAndCreateNewRow; + } + if (!m_pCurChildNode->IsContainerNode()) + break; + + bool bNewRow = false; + if (m_pCurChildPreprocessor) { + pProcessor.reset(m_pCurChildPreprocessor); + m_pCurChildPreprocessor = nullptr; + bNewRow = true; + } else { + pProcessor = pdfium::MakeUnique( + m_pCurChildNode, m_pPageMgr); + } + + InsertPendingItems(pProcessor.get(), m_pCurChildNode); + XFA_ItemLayoutProcessorResult rs = InsertFlowedItem( + this, pProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, + &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, + fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, bNewRow); + switch (rs) { + case XFA_ItemLayoutProcessorResult::ManualBreak: + bIsManualBreak = true; + case XFA_ItemLayoutProcessorResult::PageFullBreak: + bForceEndPage = true; + case XFA_ItemLayoutProcessorResult::RowFullBreak: + goto SuspendAndCreateNewRow; + case XFA_ItemLayoutProcessorResult::Done: + default: + fContentCurRowY += + InsertPendingItems(pProcessor.get(), m_pCurChildNode); + pProcessor.reset(); + } + break; + } + case XFA_ItemLayoutProcessorStages::Done: + break; + default: + break; + } + GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, + true); + if (bAddedItemInRow && eFlowStrategy == XFA_ATTRIBUTEENUM_Tb) + break; + else + continue; + SuspendAndCreateNewRow: + if (pProcessor) + m_pCurChildPreprocessor = pProcessor.release(); + break; + } + + CalculateRowChildPosition( + rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize, + bContainerWidthAutoSize, &fContentCalculatedWidth, + &fContentCalculatedHeight, &fContentCurRowY, fContentCurRowHeight, + fContentWidthLimit, bRootForceTb); + m_fWidthLimite = fContentCurRowAvailWidth; + if (bForceEndPage) + break; + } + + bool bRetValue = + m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done && + m_PendingNodes.empty(); + if (bBreakDone) + bRetValue = false; + + containerSize = CalculateContainerComponentSizeFromContentSize( + m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, + bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); + + if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || + bRetValue) { + if (!m_pLayoutItem) + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); + containerSize.height = std::max(containerSize.height, 0.f); + + SetCurrentComponentSize(containerSize); + if (bForceEndPage) + m_fUsedSize = 0; + else + m_fUsedSize += m_pLayoutItem->m_sSize.height; + } + + return bRetValue + ? XFA_ItemLayoutProcessorResult::Done + : (bIsManualBreak ? XFA_ItemLayoutProcessorResult::ManualBreak + : XFA_ItemLayoutProcessorResult::PageFullBreak); +} + +bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( + std::vector (&rgCurLineLayoutItems)[3], + XFA_ATTRIBUTEENUM eFlowStrategy, + bool bContainerHeightAutoSize, + bool bContainerWidthAutoSize, + float* fContentCalculatedWidth, + float* fContentCalculatedHeight, + float* fContentCurRowY, + float fContentCurRowHeight, + float fContentWidthLimit, + bool bRootForceTb) { + int32_t nGroupLengths[3] = {0, 0, 0}; + float fGroupWidths[3] = {0, 0, 0}; + int32_t nTotalLength = 0; + for (int32_t i = 0; i < 3; i++) { + nGroupLengths[i] = pdfium::CollectionSize(rgCurLineLayoutItems[i]); + for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) { + nTotalLength++; + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[i][j]->m_pFormNode)) { + fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width; + } + } + } + if (!nTotalLength) { + if (bContainerHeightAutoSize) { + *fContentCalculatedHeight = + std::min(*fContentCalculatedHeight, *fContentCurRowY); + } + return false; + } + if (!m_pLayoutItem) + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); + + if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { + float fCurPos; + fCurPos = 0; + for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { + if (bRootForceTb) { + rgCurLineLayoutItems[0][j]->m_sPos = CalculatePositionedContainerPos( + rgCurLineLayoutItems[0][j]->m_pFormNode, + rgCurLineLayoutItems[0][j]->m_sSize); + } else { + rgCurLineLayoutItems[0][j]->m_sPos = + CFX_PointF(fCurPos, *fContentCurRowY); + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[0][j]->m_pFormNode)) { + fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width; + } + } + m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]); + m_fLastRowWidth = fCurPos; + } + fCurPos = (fContentWidthLimit + fGroupWidths[0] - fGroupWidths[1] - + fGroupWidths[2]) / + 2; + for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) { + if (bRootForceTb) { + rgCurLineLayoutItems[1][j]->m_sPos = CalculatePositionedContainerPos( + rgCurLineLayoutItems[1][j]->m_pFormNode, + rgCurLineLayoutItems[1][j]->m_sSize); + } else { + rgCurLineLayoutItems[1][j]->m_sPos = + CFX_PointF(fCurPos, *fContentCurRowY); + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[1][j]->m_pFormNode)) { + fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width; + } + } + m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]); + m_fLastRowWidth = fCurPos; + } + fCurPos = fContentWidthLimit - fGroupWidths[2]; + for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) { + if (bRootForceTb) { + rgCurLineLayoutItems[2][j]->m_sPos = CalculatePositionedContainerPos( + rgCurLineLayoutItems[2][j]->m_pFormNode, + rgCurLineLayoutItems[2][j]->m_sSize); + } else { + rgCurLineLayoutItems[2][j]->m_sPos = + CFX_PointF(fCurPos, *fContentCurRowY); + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[2][j]->m_pFormNode)) { + fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width; + } + } + m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]); + m_fLastRowWidth = fCurPos; + } + } else { + float fCurPos; + fCurPos = fGroupWidths[0]; + for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[0][j]->m_pFormNode)) { + fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width; + } + rgCurLineLayoutItems[0][j]->m_sPos = + CFX_PointF(fCurPos, *fContentCurRowY); + m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]); + m_fLastRowWidth = fCurPos; + } + fCurPos = (fContentWidthLimit + fGroupWidths[0] + fGroupWidths[1] - + fGroupWidths[2]) / + 2; + for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) { + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[1][j]->m_pFormNode)) { + fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width; + } + rgCurLineLayoutItems[1][j]->m_sPos = + CFX_PointF(fCurPos, *fContentCurRowY); + m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]); + m_fLastRowWidth = fCurPos; + } + fCurPos = fContentWidthLimit; + for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) { + if (XFA_ItemLayoutProcessor_IsTakingSpace( + rgCurLineLayoutItems[2][j]->m_pFormNode)) { + fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width; + } + rgCurLineLayoutItems[2][j]->m_sPos = + CFX_PointF(fCurPos, *fContentCurRowY); + m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]); + m_fLastRowWidth = fCurPos; + } + } + m_fLastRowY = *fContentCurRowY; + *fContentCurRowY += fContentCurRowHeight; + if (bContainerWidthAutoSize) { + float fChildSuppliedWidth = fGroupWidths[0]; + if (fContentWidthLimit < FLT_MAX && + fContentWidthLimit > fChildSuppliedWidth) { + fChildSuppliedWidth = fContentWidthLimit; + } + *fContentCalculatedWidth = + std::max(*fContentCalculatedWidth, fChildSuppliedWidth); + } + if (bContainerHeightAutoSize) { + *fContentCalculatedHeight = + std::max(*fContentCalculatedHeight, *fContentCurRowY); + } + return true; +} + +CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( + CXFA_Node* pSubformSet) { + if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) { + CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); + while (pParent) { + if (pParent->GetElementType() != XFA_Element::SubformSet) + return pParent; + pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); + } + } + return pSubformSet; +} + +void CXFA_ItemLayoutProcessor::DoLayoutField() { + if (m_pLayoutItem) + return; + + ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); + m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); + if (!m_pLayoutItem) + return; + + CXFA_Document* pDocument = m_pFormNode->GetDocument(); + CXFA_FFNotify* pNotify = pDocument->GetNotify(); + CFX_SizeF size(-1, -1); + pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height); + + int32_t nRotate = + FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); + nRotate = XFA_MapRotation(nRotate); + if (nRotate == 90 || nRotate == 270) + std::swap(size.width, size.height); + + SetCurrentComponentSize(size); +} + +XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( + bool bUseBreakControl, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext) { + switch (m_pFormNode->GetElementType()) { + case XFA_Element::Subform: + case XFA_Element::Area: + case XFA_Element::ExclGroup: + case XFA_Element::SubformSet: { + bool bRootForceTb = false; + CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); + XFA_ATTRIBUTEENUM eLayoutStrategy = GetLayout(pLayoutNode, &bRootForceTb); + switch (eLayoutStrategy) { + case XFA_ATTRIBUTEENUM_Tb: + case XFA_ATTRIBUTEENUM_Lr_tb: + case XFA_ATTRIBUTEENUM_Rl_tb: + return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy, + fHeightLimit, fRealHeight, pContext, + bRootForceTb); + case XFA_ATTRIBUTEENUM_Position: + case XFA_ATTRIBUTEENUM_Row: + case XFA_ATTRIBUTEENUM_Rl_row: + default: + DoLayoutPositionedContainer(pContext); + m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done; + return XFA_ItemLayoutProcessorResult::Done; + case XFA_ATTRIBUTEENUM_Table: + DoLayoutTableContainer(pLayoutNode); + m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done; + return XFA_ItemLayoutProcessorResult::Done; + } + } + case XFA_Element::Draw: + case XFA_Element::Field: + DoLayoutField(); + m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done; + return XFA_ItemLayoutProcessorResult::Done; + case XFA_Element::ContentArea: + return XFA_ItemLayoutProcessorResult::Done; + default: + return XFA_ItemLayoutProcessorResult::Done; + } +} + +CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() { + return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height); +} + +void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) { + m_pLayoutItem->m_sPos = pos; +} + +void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(const CFX_SizeF& size) { + m_pLayoutItem->m_sSize = size; +} + +bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( + CXFA_Node* pFormNode) { + if (!pFormNode) + return false; + + CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); + if (!pTemplate) + pTemplate = pFormNode; + + CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur)); + int32_t iMax = NodeOccur.GetMax(); + if (iMax < 0) + return true; + + int32_t iCount = m_PendingNodesCount[pTemplate]; + if (iCount >= iMax) + return false; + + m_PendingNodesCount[pTemplate] = iCount + 1; + return true; +} diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h new file mode 100644 index 0000000000..d5d706e62e --- /dev/null +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h @@ -0,0 +1,172 @@ +// 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 + +#ifndef XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_ +#define XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_ + +#include + +#include +#include +#include +#include + +#include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/fx_coordinates.h" +#include "xfa/fxfa/fxfa_basic.h" + +#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1) +#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f) + +class CXFA_ContainerLayoutItem; +class CXFA_ContentLayoutItem; +class CXFA_ItemLayoutProcessor; +class CXFA_LayoutContext; +class CXFA_LayoutPageMgr; +class CXFA_LayoutProcessor; +class CXFA_Node; + +enum class XFA_ItemLayoutProcessorResult { + Done, + PageFullBreak, + RowFullBreak, + ManualBreak, +}; + +enum class XFA_ItemLayoutProcessorStages { + None, + BookendLeader, + BreakBefore, + Keep, + Container, + BreakAfter, + BookendTrailer, + Done, +}; + +bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode); + +class CXFA_ItemLayoutProcessor { + public: + static bool IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor, + CXFA_Node* pNode, + CXFA_Node* pParentNode); + + CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); + ~CXFA_ItemLayoutProcessor(); + + XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext); + void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem); + + CFX_SizeF GetCurrentComponentSize(); + CXFA_Node* GetFormNode() { return m_pFormNode; } + bool HasLayoutItem() const { return !!m_pLayoutItem; } + CXFA_ContentLayoutItem* ExtractLayoutItem(); + void SplitLayoutItem(float fSplitPos); + + float FindSplitPos(float fProposedSplitPos); + + bool ProcessKeepForSplit( + CXFA_ItemLayoutProcessor* pParentProcessor, + CXFA_ItemLayoutProcessor* pChildProcessor, + XFA_ItemLayoutProcessorResult eRetValue, + std::vector* rgCurLineLayoutItem, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, + float* fContentCurRowY, + bool* bAddedItemInRow, + bool* bForceEndPage, + XFA_ItemLayoutProcessorResult* result); + void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode, + CXFA_Node* pTrailerNode, + CXFA_ContentLayoutItem* pTrailerItem, + CXFA_Node* pFormNode); + bool IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem); + bool JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode); + + CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode); + + CXFA_Node* m_pFormNode; + CXFA_ContentLayoutItem* m_pLayoutItem; + CXFA_Node* m_pCurChildNode; + float m_fUsedSize; + CXFA_LayoutPageMgr* m_pPageMgr; + std::list m_PendingNodes; + bool m_bBreakPending; + std::vector m_rgSpecifiedColumnWidths; + std::vector m_arrayKeepItems; + float m_fLastRowWidth; + float m_fLastRowY; + bool m_bUseInheriated; + XFA_ItemLayoutProcessorResult m_ePreProcessRs; + + private: + void SetCurrentComponentPos(const CFX_PointF& pos); + void SetCurrentComponentSize(const CFX_SizeF& size); + + void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem, + CXFA_ContentLayoutItem* pSecondParent, + float fSplitPos); + float InsertKeepLayoutItems(); + bool CalculateRowChildPosition( + std::vector (&rgCurLineLayoutItems)[3], + XFA_ATTRIBUTEENUM eFlowStrategy, + bool bContainerHeightAutoSize, + bool bContainerWidthAutoSize, + float* fContentCalculatedWidth, + float* fContentCalculatedHeight, + float* fContentCurRowY, + float fContentCurRowHeight, + float fContentWidthLimit, + bool bRootForceTb); + void ProcessUnUseBinds(CXFA_Node* pFormNode); + bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem, + float fChildHeight, + std::vector* pKeepItems); + + void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext); + void DoLayoutTableContainer(CXFA_Node* pLayoutNode); + XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( + bool bUseBreakControl, + XFA_ATTRIBUTEENUM eFlowStrategy, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext, + bool bRootForceTb); + void DoLayoutField(); + + void GotoNextContainerNode(CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node* pParentContainer, + bool bUsePageBreak); + + bool ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node*& pNextContainer, + bool& bLastKeepNode); + + bool ProcessKeepNodesForBreakBefore(CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node* pContainerNode); + + CXFA_Node* GetSubformSetParent(CXFA_Node* pSubformSet); + + bool m_bKeepBreakFinish; + bool m_bIsProcessKeep; + CXFA_Node* m_pKeepHeadNode; + CXFA_Node* m_pKeepTailNode; + CXFA_ContentLayoutItem* m_pOldLayoutItem; + CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor; + XFA_ItemLayoutProcessorStages m_nCurChildNodeStage; + std::map m_PendingNodesCount; + float m_fWidthLimite; + bool m_bHasAvailHeight; +}; + +#endif // XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_ diff --git a/xfa/fxfa/parser/cxfa_layoutcontext.h b/xfa/fxfa/parser/cxfa_layoutcontext.h new file mode 100644 index 0000000000..a133ee19d9 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_layoutcontext.h @@ -0,0 +1,32 @@ +// Copyright 2017 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 + +#ifndef XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_ +#define XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_ + +#include + +class CXFA_ItemLayoutProcess; +class CXFA_Node; + +class CXFA_LayoutContext { + public: + CXFA_LayoutContext() + : m_prgSpecifiedColumnWidths(nullptr), + m_fCurColumnWidth(0), + m_bCurColumnWidthAvaiable(false), + m_pOverflowProcessor(nullptr), + m_pOverflowNode(nullptr) {} + ~CXFA_LayoutContext() {} + + std::vector* m_prgSpecifiedColumnWidths; + float m_fCurColumnWidth; + bool m_bCurColumnWidthAvaiable; + CXFA_ItemLayoutProcessor* m_pOverflowProcessor; + CXFA_Node* m_pOverflowNode; +}; + +#endif // XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_ diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index a0d67d2053..bee4fe9ae6 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -11,14 +11,14 @@ #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" -#include "xfa/fxfa/parser/xfa_layout_itemlayout.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -1632,9 +1632,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { } } -CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( - CXFA_Node* pFormNode, - CXFA_LayoutContext* pLayoutContext) { +CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) { for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { if (pCurNode->GetElementType() == XFA_Element::Break) { diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.h b/xfa/fxfa/parser/cxfa_layoutpagemgr.h index 7428374ae0..085ea89671 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.h +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.h @@ -12,10 +12,11 @@ #include #include -#include "xfa/fxfa/parser/xfa_layout_itemlayout.h" +#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h" class CXFA_ContainerRecord; class CXFA_LayoutItem; +class CXFA_Node; class CXFA_LayoutPageMgr { public: @@ -46,8 +47,7 @@ class CXFA_LayoutPageMgr { CXFA_Node*& pTrailerNode, bool bDataMerge = false, bool bCreatePage = true); - CXFA_Node* QueryOverflow(CXFA_Node* pFormNode, - CXFA_LayoutContext* pLayoutContext = nullptr); + CXFA_Node* QueryOverflow(CXFA_Node* pFormNode); bool ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode, bool bLeader, CXFA_Node*& pBookendAppendNode); diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index c97a1cea58..10ae66739b 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -10,11 +10,11 @@ #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h" #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" -#include "xfa/fxfa/parser/xfa_layout_itemlayout.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp new file mode 100644 index 0000000000..b9f2615f41 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -0,0 +1,1249 @@ +// 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/parser/cxfa_localemgr.h" + +#include + +#include +#include + +#include "core/fxcodec/fx_codec.h" +#include "core/fxcrt/fx_xml.h" +#include "core/fxge/cfx_gemodule.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_nodelocale.h" +#include "xfa/fxfa/parser/cxfa_xmllocale.h" +#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +const uint8_t g_enUS_Locale[] = { + 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6E, 0x9B, 0x30, 0x14, 0x7D, 0x9F, 0xB4, + 0x7F, 0x40, 0xD6, 0x2A, 0xB5, 0x52, 0x56, 0x6F, 0x8F, 0xA9, 0x88, 0xA5, + 0x6C, 0x24, 0x9B, 0x3A, 0xD1, 0x55, 0x22, 0x55, 0xB5, 0xBE, 0x4C, 0x0E, + 0xDC, 0x05, 0x34, 0xB0, 0x23, 0x83, 0x37, 0x05, 0xED, 0xE3, 0x67, 0x07, + 0xC3, 0xC0, 0xF6, 0x24, 0xC2, 0x4B, 0x7C, 0xCF, 0x3D, 0xE7, 0xE6, 0xDE, + 0x63, 0x30, 0x84, 0x25, 0x4F, 0x69, 0x09, 0x01, 0xA3, 0x15, 0xAC, 0x10, + 0xB0, 0xEF, 0x4F, 0x09, 0x0A, 0x32, 0xA8, 0xD3, 0x15, 0xDA, 0xB0, 0x43, + 0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 0x36, 0xA9, 0x63, 0xC9, 0x80, 0x57, 0x51, 0x32, 0x02, 0x5B, 0x7A, + 0x2C, 0xA3, 0x2C, 0x9F, 0x93, 0xF4, 0x36, 0x7C, 0x75, 0xD9, 0xD2, 0x02, + 0x0C, 0x4C, 0x98, 0x76, 0x7D, 0x97, 0xF8, 0x03, 0xD3, 0x53, 0x24, 0xA4, + 0x2E, 0xA6, 0xCC, 0x5F, 0x98, 0x8F, 0x4B, 0x58, 0x70, 0xFF, 0x41, 0x98, + 0xC3, 0x75, 0x8A, 0x37, 0x86, 0x10, 0xAA, 0xD4, 0xAC, 0xC3, 0x4B, 0x35, + 0x98, 0xB0, 0xE8, 0x98, 0xAE, 0x30, 0x3D, 0x4F, 0xA2, 0x70, 0xCD, 0x94, + 0x66, 0x49, 0xE0, 0xB8, 0x16, 0xEB, 0xA3, 0xF2, 0xF4, 0x91, 0xA4, 0x0F, + 0xA3, 0x42, 0xCB, 0x96, 0x43, 0x12, 0xEA, 0x93, 0x21, 0x9B, 0x02, 0x73, + 0xD8, 0x68, 0x39, 0xA9, 0x1D, 0xFA, 0x8D, 0x55, 0xD2, 0xE3, 0xF1, 0x7D, + 0xD1, 0xCD, 0x33, 0x63, 0x51, 0xFC, 0x15, 0x0D, 0xCB, 0xBF, 0xC0, 0xE4, + 0x3D, 0x40}; +const uint8_t g_zhTW_Locale[] = { + 0x78, 0x9C, 0xED, 0x57, 0xCD, 0x4F, 0xD4, 0x40, 0x14, 0x3F, 0x63, 0xE2, + 0xFF, 0x30, 0x69, 0x20, 0xD5, 0x04, 0xA8, 0x1E, 0x21, 0xA5, 0xC9, 0xC6, + 0x45, 0x30, 0x58, 0x42, 0xEC, 0x46, 0x22, 0x17, 0x33, 0xDB, 0x0E, 0xDB, + 0xC2, 0xB6, 0x43, 0x66, 0xDB, 0xC0, 0xF6, 0x24, 0x12, 0x14, 0x14, 0x62, + 0xA2, 0xC4, 0x8F, 0x80, 0xE1, 0x64, 0x3C, 0x28, 0x89, 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0xC6, 0xE3, 0x2C, 0x61, + 0x98, 0x4B, 0x68, 0x10, 0xEC, 0xAD, 0x59, 0x6C, 0x26, 0x46, 0x4B, 0x32, + 0x92, 0x0E, 0x46, 0x4A, 0x12, 0x6C, 0xCB, 0xF1, 0x5A, 0x82, 0x32, 0x56, + 0x12, 0xEE, 0x23, 0x82, 0x05, 0xE5, 0x56, 0x01, 0x7D, 0x29, 0x4C, 0xE6, + 0xBD, 0xE3, 0xC7, 0xC8, 0x28, 0x93, 0x75, 0xC6, 0x63, 0x18, 0x18, 0x82, + 0x32, 0x5F, 0x1B, 0xA6, 0x2B, 0x29, 0x83, 0x18, 0xC0, 0xB2, 0x5A, 0x98, + 0x1D, 0x04, 0xA5, 0xB6, 0x58, 0xFD, 0x0B, 0x5A, 0xFA, 0x21, 0x0A, 0xA4, + 0x60, 0x27, 0x16, 0xEA, 0x66, 0x4B, 0xA0, 0xBD, 0x86, 0x96, 0xA1, 0x1E, + 0xAF, 0xE0, 0xD8, 0x8C, 0x72, 0x56, 0x0C, 0x5C, 0x47, 0x40, 0xA5, 0xAF, + 0x05, 0x34, 0xD7, 0x00, 0xF7, 0x05, 0xA9, 0x2F, 0x4C, 0x6D, 0xD3, 0x9F, + 0x90, 0x06, 0x58, 0xA0, 0x32, 0x72, 0x00, 0x96, 0x63, 0x61, 0x67, 0x00, + 0xE0, 0x0E, 0xF6, 0x88, 0x85, 0x08, 0xBB, 0x85, 0x83, 0x08, 0x4B, 0x59, + 0xB0, 0xAE, 0x84, 0xCC, 0xA2, 0x3A, 0x41, 0xEB, 0x03, 0x21, 0x15, 0x02, + 0xEB, 0xF4, 0x8B, 0x38, 0x08, 0x52, 0x33, 0xA1, 0xC5, 0x01, 0xCC, 0x61, + 0xDF, 0x5B, 0x85, 0x60, 0x06, 0xBB, 0xA6, 0xA5, 0xB3, 0x9E, 0xC6, 0x1E, + 0xDE, 0x03, 0xEA, 0x60, 0x30, 0x15, 0x40, 0x37, 0x71, 0x0C, 0x7E, 0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, 0xCF, 0x8D, 0x09, 0x9D, 0xBD, 0x77, 0x30, 0x21, 0x67, 0xC2, 0xA0, + 0x77, 0x23, 0xED, 0x80, 0x13, 0xB3, 0xB9, 0x41, 0xF2, 0x6C, 0x85, 0x18, + 0x5D, 0x54, 0x5A, 0x05, 0xD1, 0x05, 0x95, 0xCD, 0xFE, 0x83, 0x2C, 0x78, + 0x10, 0x31, 0x91, 0xFD, 0x6E, 0xC6, 0xFA, 0xA6, 0xEF, 0x41, 0x6D, 0x0D, + 0x2E, 0x4B, 0xB2, 0xF7, 0x4C, 0x7B, 0xA1, 0x5B, 0x73, 0x46, 0x41, 0x45, + 0x08, 0xF2, 0xE4, 0xB4, 0x40, 0xC1, 0x54, 0xC0, 0x6D, 0x2E, 0x95, 0x48, + 0xCB, 0xD7, 0xC8, 0xDF, 0x92, 0x0A, 0x58, 0x20, 0x36, 0x32, 0x08, 0x9A, + 0xA1, 0x21, 0xA3, 0x0B, 0xE1, 0x06, 0xAA, 0x62, 0x0D, 0x62, 0xBA, 0x0B, + 0x83, 0xE1, 0xB4, 0xB2, 0xA0, 0xF5, 0xA4, 0x64, 0x61, 0x11, 0xC3, 0xF5, + 0xAE, 0x94, 0x19, 0x2C, 0x15, 0xC9, 0x47, 0xD9, 0x8D, 0xB2, 0xA8, 0x4A, + 0x1A, 0x83, 0x90, 0x43, 0x56, 0x75, 0x55, 0x02, 0xF3, 0xC8, 0x54, 0x35, + 0x99, 0xCE, 0x34, 0x76, 0xEF, 0x16, 0xC8, 0x77, 0x27, 0x13, 0x03, 0x64, + 0x15, 0x79, 0xE4, 0xBB, 0x5D, 0xB7, 0x2E, 0xA0, 0x1E, 0x76, 0xBB, 0xA7, + 0x52, 0xAB, 0x1A, 0xA5, 0x15, 0x64, 0x33, 0x9D, 0xDD, 0xED, 0x47, 0x2E, + 0x70, 0x9E, 0x42, 0xCA, 0xF9, 0x27, 0x42, 0xFC, 0x0B, 0xD9, 0x0E, 0x4B, + 0xED}; +const uint8_t g_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, 0x96, + 0x9A, 0x2E, 0x63, 0x88, 0x98, 0x1D, 0x49, 0x3B, 0xE3, 0x8B, 0x4B, 0x0B, + 0x77, 0x10, 0x33, 0x11, 0x71, 0xC2, 0x67, 0x9E, 0xCD, 0xEA, 0x84, 0x19, + 0x99, 0x06, 0xE2, 0xA6, 0x86, 0x7D, 0x4E, 0xA4, 0xA1, 0x30, 0xBD, 0x85, + 0x4C, 0x6C, 0x43, 0xBE, 0x1B, 0xA6, 0xA3, 0x2C, 0xC1, 0xED, 0x42, 0x41, + 0x83, 0x51, 0x77, 0x07, 0x8B, 0xF9, 0x4F, 0x96, 0x54, 0xC4, 0x1D, 0x9C, + 0x2D, 0x29, 0xB0, 0x31, 0x71, 0xDB, 0x92, 0x36, 0x55, 0x92, 0xEE, 0x21, + 0x46, 0x25, 0x6D, 0x26, 0xC3, 0x1E, 0x1A, 0x93, 0x1A, 0x76, 0x34, 0x89, + 0x94, 0x33, 0x69, 0x30, 0xDA, 0x81, 0x7E, 0x20, 0x69, 0x7F, 0x0E, 0xF9, + 0x89, 0x9D, 0x66, 0x8C, 0x51, 0xE1, 0x36, 0x15, 0x0B, 0x49, 0x5B, 0xA9, + 0xAD, 0x9F, 0x40, 0x96, 0x1C, 0x44, 0x46, 0xE4, 0x1F, 0x7F, 0x99, 0xBA, + 0xC5, 0xDB, 0xDE, 0xD9, 0x41, 0x9B, 0xD0, 0x8C, 0x4E, 0xDB, 0x28, 0x0C, + 0x73, 0xAE, 0x52, 0xCF, 0xDD, 0x86, 0x60, 0x99, 0x3A, 0x4D, 0x6C, 0x82, + 0x1A, 0xA3, 0x53, 0x77, 0x6F, 0x02, 0x5D, 0x52, 0xC6, 0x91, 0x75, 0x4C, + 0xCC, 0x26, 0x8D, 0xC8, 0x77, 0x0A, 0xC8, 0x7A, 0x87, 0x7F, 0x2A, 0x5A, + 0x82, 0x55, 0x44, 0xC0, 0x04, 0x53, 0x32, 0x86, 0x70, 0x9D, 0xBA, 0x0C, + 0x23, 0x06, 0x0C, 0xC7, 0x2A, 0x60, 0x2C, 0x58, 0xB4, 0x8E, 0x40, 0x0D, + 0xFF, 0x93, 0x52, 0x45, 0x75, 0x86, 0x76, 0xC7, 0x52, 0x16, 0x18, 0xAC, + 0xF3, 0x17, 0x77, 0x1C, 0x65, 0xAD, 0x09, 0xF1, 0x58, 0x02, 0x6F, 0xA9, + 0x21, 0x6A, 0x01, 0xB7, 0xC6, 0xD2, 0x0C, 0x5A, 0x8A, 0xA6, 0x77, 0x5C, + 0xD2, 0xD8, 0xA2, 0x3E, 0x33, 0x18, 0x89, 0x7F, 0xAA, 0x25, 0xE6, 0xA9, + 0x2A, 0xC1, 0x87, 0xBD, 0xF6, 0x17, 0x6C, 0x42, 0x08, 0x21}; +const uint8_t g_koKR_Locale[] = { + 0x78, 0x9C, 0xED, 0x56, 0x4D, 0x6B, 0xD4, 0x40, 0x18, 0x3E, 0x57, 0xF0, + 0x3F, 0x0C, 0xC1, 0x12, 0x85, 0x76, 0xB7, 0xEB, 0x77, 0x4B, 0x1A, 0x28, + 0x6E, 0x6D, 0x65, 0x8D, 0x94, 0xA6, 0x58, 0xEC, 0x45, 0x66, 0x93, 0xE9, + 0x26, 0xED, 0x26, 0x53, 0x26, 0x09, 0x75, 0x73, 0xAE, 0x52, 0xF0, 0xE2, + 0xA1, 0x87, 0xEA, 0x6E, 0xB1, 0x07, 0x11, 0x2A, 0x88, 0x22, 0x22, 0x1E, + 0x14, 0x7F, 0x8D, 0x62, 0x6D, 0x8A, 0x7F, 0xC1, 0xC9, 0xE7, 0xE6, 0x63, + 0xB2, 0x4D, 0xEF, 0xEE, 0x61, 0x99, 0xF7, 0x99, 0xE7, 0x79, 0xF3, 0xBE, + 0xCF, 0x4C, 0x5E, 0x22, 0x74, 0xB1, 0x02, 0xBB, 0x08, 0x98, 0xD0, 0x40, + 0xB3, 0xDC, 0x26, 0x7E, 0xDC, 0x5A, 0xE6, 0x80, 0x8A, 0x2C, 0x65, 0x96, + 0xFB, 0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 0x31, 0x42, 0xA5, 0x5B, 0xD8, 0x5F, 0x70, 0x62, 0x6B, + 0x79, 0xF5, 0x1C, 0xB2, 0xF4, 0x41, 0x14, 0x44, 0xC1, 0x84, 0x2C, 0xD4, + 0xED, 0xCF, 0x81, 0xDE, 0x16, 0x5A, 0x87, 0x4A, 0x3C, 0x90, 0xE3, 0x30, + 0xCA, 0x39, 0xA7, 0xE2, 0x36, 0x02, 0x52, 0xCF, 0x31, 0x3B, 0x1B, 0x18, + 0xC8, 0xB6, 0x0A, 0x24, 0xAE, 0xCE, 0x64, 0x4A, 0x3D, 0xFA, 0x75, 0xA8, + 0x82, 0x25, 0xEA, 0x64, 0x09, 0x41, 0x37, 0x75, 0x6C, 0x8E, 0x20, 0xDC, + 0xC1, 0x0E, 0xD1, 0x11, 0xF1, 0x9F, 0x52, 0xC2, 0x08, 0xAB, 0x59, 0xD2, + 0xCF, 0xA4, 0x2C, 0xA2, 0x36, 0x41, 0xDB, 0x23, 0x29, 0x73, 0x04, 0xB6, + 0xE9, 0x8B, 0x38, 0x8A, 0xB2, 0xA2, 0x41, 0xBD, 0x84, 0xD0, 0xC2, 0xAE, + 0xB3, 0x09, 0xC1, 0x02, 0xB6, 0x35, 0x5D, 0xF1, 0x7B, 0x9A, 0x7C, 0x78, + 0xAF, 0xD4, 0x9A, 0x88, 0x4C, 0x0D, 0x50, 0x34, 0x1C, 0x93, 0x97, 0x47, + 0x3E, 0x9A, 0x72, 0x3B, 0x81, 0xDD, 0xF7, 0x47, 0xD2, 0x64, 0x9C, 0xA1, + 0x05, 0x53, 0x2D, 0x75, 0x9E, 0x42, 0x3D, 0xFC, 0xFC, 0x17, 0xFF, 0x01, + 0xDC, 0xF1, 0x18, 0xD3}; +const uint8_t g_esES_Locale[] = { + 0x78, 0x9C, 0x9D, 0x56, 0xCF, 0x6B, 0xD4, 0x40, 0x14, 0xBE, 0x0B, 0xFE, + 0x0F, 0x21, 0x58, 0x56, 0xA1, 0xDD, 0xD1, 0x63, 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 0x60, 0x17, 0x5E, 0x98, + 0xF9, 0x84, 0xFD, 0x11, 0xA6, 0xDA, 0xF4, 0x2E, 0x4F, 0x93, 0x63, 0x6C, + 0xEC, 0xF0, 0x78, 0x44, 0x3D, 0x39, 0xC7, 0xCA, 0x93, 0x07, 0x86, 0xBD, + 0x88, 0x0A, 0x23, 0x7B, 0x23, 0x9E, 0x53, 0xF7, 0x16, 0xDC, 0x14, 0x98, + 0x43, 0x39, 0x99, 0xF1, 0x70, 0x01, 0xC9, 0xE1, 0x2D, 0x48, 0xF6, 0x24, + 0x61, 0xC3, 0x23, 0x3E, 0xE5, 0xA9, 0xE6, 0xD0, 0x6C, 0xCF, 0x64, 0x94, + 0xFD, 0xFC, 0xC2, 0xF2, 0x2F, 0x7C, 0xDC, 0xCC, 0x2F, +}; +const uint8_t g_esLA_Locale[] = { + 0x78, 0x9C, 0x9D, 0x56, 0xCD, 0x4E, 0xDC, 0x30, 0x10, 0x3E, 0x53, 0xA9, + 0xEF, 0x60, 0x45, 0x45, 0x80, 0x04, 0x9B, 0xF6, 0xB8, 0x28, 0x44, 0x5A, + 0x01, 0xA5, 0x15, 0x0D, 0x5A, 0x75, 0x51, 0x4B, 0xB9, 0x54, 0x4E, 0x62, + 0x36, 0x86, 0xC4, 0x5E, 0x39, 0x09, 0x68, 0xA3, 0xBE, 0x40, 0x4F, 0x3D, + 0xF4, 0xD4, 0x63, 0x2B, 0x21, 0xB5, 0x07, 0xD4, 0x47, 0xE8, 0x81, 0x67, + 0x41, 0xF0, 0x18, 0x9D, 0xFC, 0x6E, 0x12, 0x3B, 0xE9, 0xD2, 0x9C, 0x3C, + 0xDF, 0x7C, 0x9F, 0x77, 0xE6, 0xB3, 0x33, 0x1B, 0xC3, 0xE7, 0x0E, 0xF6, + 0x09, 0x62, 0x38, 0x20, 0x3B, 0x1A, 0x09, 0x3F, 0x5A, 0x27, 0x1A, 0x72, + 0x49, 0xE8, 0xEC, 0x68, 0x0F, 0xD7, 0x7F, 0xEE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A, 0xCC, 0x59, 0x39, + 0x19, 0x7A, 0xB3, 0x82, 0x04, 0x6F, 0xFA, 0xC7, 0x49, 0xFE, 0x22, 0x67, + 0xB3, 0x2B, 0xBE, 0xE4, 0xA9, 0xE6, 0xDC, 0xFB, 0x3D, 0x2B, 0xA3, 0xEA, + 0x73, 0x16, 0x96, 0xFF, 0x00, 0x29, 0x27, 0xAF, 0x17, +}; +const uint8_t g_frFR_Locale[] = { + 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x6F, 0xD3, 0x40, 0x10, 0xBD, 0x23, 0xF1, + 0x1F, 0x56, 0x16, 0x55, 0x41, 0x6A, 0xBD, 0x70, 0x4C, 0x95, 0x5A, 0xAA, + 0xFA, 0x15, 0x28, 0x46, 0x51, 0x53, 0x40, 0xF4, 0x82, 0x36, 0xF6, 0x36, + 0xDE, 0xD4, 0xDE, 0x8D, 0xD6, 0x76, 0x4A, 0x7C, 0xE4, 0x3F, 0x70, 0xE2, + 0xC2, 0xB5, 0x12, 0x88, 0x03, 0x47, 0xC4, 0x85, 0xFE, 0x13, 0x24, 0x10, + 0x3F, 0x83, 0x71, 0xBC, 0x76, 0xED, 0x5D, 0x27, 0xB8, 0xBE, 0x64, 0xE7, + 0xCD, 0x7B, 0xE3, 0x99, 0xB7, 0xF6, 0xC6, 0xFD, 0x50, 0x78, 0x24, 0xA4, + 0x88, 0x93, 0x88, 0xEE, 0x5A, 0x17, 0xF2, 0xED, 0xD1, 0xA9, 0x85, 0x7C, + 0x1A, 0x7B, 0xBB, 0xD6, 0x9F, 0x6F, 0x1F, 0xFE, 0x7E, 0xFD, 0xF2, 0x10, + 0x7E, 0x7E, 0x7F, 0xFC, 0xF1, 0xC8, 0x72, 0xFA, 0x39, 0x91, 0xFB, 0x44, + 0x8E, 0x16, 0xD1, 0x58, 0x84, 0xB1, 0xD2, 0x4C, 0x24, 0x9D, 0x08, 0xC9, + 0x08, 0x07, 0x46, 0x24, 0x78, 0x12, 0xBC, 0x00, 0x38, 0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0x99, 0x66, 0x9C, 0x09, 0xBE, 0x32, 0xBD, 0x2F, 0xD2, 0xFC, 0x3B, 0x08, + 0x8D, 0x12, 0xBF, 0x35, 0xBF, 0xE7, 0x8B, 0x31, 0x45, 0x43, 0xF6, 0x1F, + 0xC2, 0x80, 0xC2, 0x57, 0xC6, 0xD5, 0x1A, 0xC2, 0x9E, 0x24, 0x63, 0x78, + 0x63, 0x56, 0x13, 0xCE, 0x02, 0xC2, 0x5A, 0xD3, 0x27, 0x22, 0x4B, 0x2F, + 0x09, 0x3A, 0x16, 0x49, 0xC0, 0xBC, 0x7C, 0x8E, 0xED, 0x57, 0x4F, 0x91, + 0xBB, 0x8E, 0x0A, 0x23, 0x7B, 0x81, 0x28, 0xA9, 0xA7, 0x6B, 0x6E, 0x0A, + 0xCC, 0x49, 0x3E, 0x19, 0x7A, 0xBE, 0x86, 0x34, 0x12, 0x1D, 0x48, 0xEE, + 0x22, 0xE5, 0x93, 0xA9, 0x58, 0xF2, 0x54, 0x73, 0xF8, 0x76, 0xCF, 0xF2, + 0xA8, 0xF8, 0xD2, 0x85, 0xE5, 0x3F, 0x5D, 0x49, 0xBE, 0x1B}; +const uint8_t g_itIT_Locale[] = { + 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6A, 0xD4, 0x40, 0x14, 0x7D, 0x17, 0xFC, + 0x87, 0x21, 0x58, 0x50, 0x68, 0x3B, 0xFA, 0xD8, 0x92, 0x06, 0x4A, 0x5B, + 0xBB, 0xA5, 0x46, 0x96, 0xEE, 0xAA, 0xD8, 0x17, 0x99, 0x64, 0xA6, 0xD9, + 0xB1, 0xC9, 0xCC, 0x32, 0x49, 0x5A, 0x92, 0x47, 0xF1, 0xC1, 0x37, 0x7F, + 0x42, 0x10, 0x41, 0xF1, 0x23, 0xFC, 0x13, 0xA1, 0xE2, 0x67, 0x78, 0xB3, + 0x99, 0xA4, 0xC9, 0x64, 0xBA, 0xA6, 0x79, 0xD9, 0xB9, 0xE7, 0x9E, 0x73, + 0x73, 0xEF, 0x99, 0x64, 0x36, 0x6E, 0x2C, 0x43, 0x12, 0x33, 0x24, 0x48, + 0xC2, 0xF6, 0x1C, 0x9E, 0xBD, 0x3B, 0x99, 0x3B, 0x88, 0xB2, 0x34, 0xDC, + 0x73, 0xFE, 0x7C, 0xFC, 0x7C, 0xF3, 0xE5, 0xEB, 0xCD, 0xA7, 0x6F, 0x7F, + 0x7F, 0xFE, 0x78, 0xDC, 0x06, 0x4F, 0x1C, 0xCF, 0xAD, 0x14, 0x82, 0x12, + 0x35, 0x2B, 0x92, 0x40, 0xC6, 0xA9, 0x16, 0x47, 0x8A, 0x45, 0x52, 0x71, + 0x22, 0x80, 0x91, 0x48, 0x91, 0x2D, 0x5E, 0x02, 0x9C, 0xEA, 0xB5, 0x17, + 0x31, 0x21, 0x08, 0x97, 0x2E, 0xAE, 0xC3, 0x87, 0x0F, 0x34, 0x7E, 0xC1, + 0x82, 0x40, 0xD9, 0x12, 0x09, 0x51, 0xE5, 0x10, 0x25, 0x4B, 0xC5, 0x63, + 0x66, 0x21, 0x47, 0x91, 0xA5, 0x46, 0xC4, 0xF3, 0x48, 0x0C, 0xE1, 0x38, + 0x8F, 0x62, 0x0B, 0x9B, 0x44, 0x32, 0xCD, 0x86, 0x70, 0xCA, 0xB2, 0x8C, + 0x25, 0x81, 0x1A, 0xDE, 0x55, 0x66, 0x99, 0xB4, 0xE1, 0x42, 0x5E, 0xD9, + 0x05, 0x94, 0x87, 0x66, 0x02, 0x77, 0xAC, 0x6A, 0x78, 0xAB, 0x08, 0x11, + 0x30, 0x66, 0xCF, 0x79, 0xE6, 0x74, 0x1C, 0xB4, 0xB9, 0x67, 0x33, 0xCE, + 0x66, 0x9B, 0xCD, 0x33, 0x9B, 0x61, 0x36, 0xB7, 0x6C, 0x56, 0xD9, 0x7C, + 0xB2, 0x39, 0x64, 0x73, 0xC7, 0x66, 0xCC, 0xDD, 0x9E, 0x50, 0x52, 0xE8, + 0x47, 0x09, 0x56, 0x1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x9B, 0x78, 0x4D, 0x56, 0x82, 0xBB, + 0x35, 0xD8, 0xFA, 0x3E, 0xA5, 0x16, 0xFC, 0xE0, 0x54, 0xD1, 0x12, 0xD4, + 0xA7, 0x98, 0x4E, 0xD0, 0x0C, 0x8D, 0x18, 0x39, 0x84, 0x07, 0xC4, 0xA2, + 0x1A, 0xA6, 0xA8, 0x62, 0xAA, 0x19, 0x8C, 0x59, 0x95, 0x54, 0x31, 0x5A, + 0xD2, 0xFE, 0x4A, 0x59, 0xC0, 0x55, 0x8A, 0xB7, 0x72, 0x29, 0xB3, 0x54, + 0xAE, 0xC2, 0x23, 0x96, 0x47, 0x59, 0xAE, 0xCB, 0x5A, 0x06, 0x61, 0x91, + 0xD8, 0xD6, 0x86, 0x8C, 0xE6, 0x89, 0x59, 0xD7, 0x14, 0x9E, 0xD3, 0xD4, + 0xB3, 0xC7, 0x48, 0xCA, 0x27, 0x43, 0x01, 0x94, 0x3A, 0x09, 0xC8, 0xE5, + 0xDC, 0xA3, 0x81, 0x5B, 0xE3, 0x59, 0xA2, 0x27, 0xB9, 0xB4, 0x0A, 0x19, + 0x89, 0x26, 0xB5, 0x2C, 0xA3, 0xB6, 0x4E, 0x5C, 0xA6, 0x17, 0xA4, 0x7B, + 0xB3, 0x85, 0xFA, 0x59, 0x2A, 0x7A, 0xFF, 0x3D, 0xC4, 0x3F, 0xDE, 0xCB, + 0x8B, 0xC4}; + +static std::unique_ptr XFA_GetLocaleFromBuffer(const uint8_t* pBuf, + int nBufLen) { + if (!pBuf || nBufLen <= 0) + return nullptr; + CFX_GEModule* pGeModule = CFX_GEModule::Get(); + if (!pGeModule) + return nullptr; + + CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); + if (!pCodecMgr) + return nullptr; + + std::unique_ptr pLocale; + uint8_t* pOut = nullptr; + uint32_t dwSize; + pCodecMgr->GetFlateModule()->FlateOrLZWDecode(false, pBuf, nBufLen, true, 0, + 0, 0, 0, 0, pOut, dwSize); + if (pOut) { + pLocale = CXML_Element::Parse(pOut, dwSize); + FX_Free(pOut); + } + return pLocale ? std::unique_ptr( + new CXFA_XMLLocale(std::move(pLocale))) + : nullptr; +} + +static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { + uint16_t dwLangueID = XFA_LANGID_en_US; + if (wsLanguage.GetLength() < 2) { + return dwLangueID; + } + wsLanguage.MakeLower(); + uint32_t dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1); + uint32_t dwIDSecond = wsLanguage.GetLength() >= 5 + ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4) + : 0; + switch (dwIDFirst) { + case FXBSTR_ID(0, 0, 'z', 'h'): { + if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) { + dwLangueID = XFA_LANGID_zh_CN; + } else if (dwIDSecond == FXBSTR_ID(0, 0, 't', 'w')) { + dwLangueID = XFA_LANGID_zh_TW; + } else if (dwIDSecond == FXBSTR_ID(0, 0, 'h', 'k')) { + dwLangueID = XFA_LANGID_zh_HK; + } + } break; + case FXBSTR_ID(0, 0, 'j', 'a'): + dwLangueID = XFA_LANGID_ja_JP; + break; + case FXBSTR_ID(0, 0, 'k', 'o'): + dwLangueID = XFA_LANGID_ko_KR; + break; + case FXBSTR_ID(0, 0, 'e', 'n'): { + if (dwIDSecond == FXBSTR_ID(0, 0, 'g', 'b')) { + dwLangueID = XFA_LANGID_en_GB; + } else { + dwLangueID = XFA_LANGID_en_US; + } + } break; + case FXBSTR_ID(0, 0, 'd', 'e'): + dwLangueID = XFA_LANGID_de_DE; + break; + case FXBSTR_ID(0, 0, 'f', 'r'): + dwLangueID = XFA_LANGID_fr_FR; + break; + case FXBSTR_ID(0, 0, 'e', 's'): { + if (dwIDSecond == FXBSTR_ID(0, 0, 'e', 's')) { + dwLangueID = XFA_LANGID_es_ES; + } else { + dwLangueID = XFA_LANGID_es_LA; + } + } break; + case FXBSTR_ID(0, 0, 'i', 't'): + dwLangueID = XFA_LANGID_it_IT; + break; + case FXBSTR_ID(0, 0, 'p', 't'): + dwLangueID = XFA_LANGID_pt_BR; + break; + case FXBSTR_ID(0, 0, 'n', 'l'): + dwLangueID = XFA_LANGID_nl_NL; + break; + case FXBSTR_ID(0, 0, 'r', 'u'): + dwLangueID = XFA_LANGID_ru_RU; + break; + } + return dwLangueID; +} + +CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) + : m_dwLocaleFlags(0x00) { + m_dwDeflcid = XFA_GetLanguage(wsDeflcid); + if (pLocaleSet) { + CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild); + while (pNodeLocale) { + m_LocaleArray.emplace_back(new CXFA_NodeLocale(pNodeLocale)); + pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); + } + } + m_pDefLocale = GetLocaleByName(wsDeflcid); +} + +CXFA_LocaleMgr::~CXFA_LocaleMgr() {} + +uint16_t CXFA_LocaleMgr::GetDefLocaleID() const { + return m_dwDeflcid; +} + +IFX_Locale* CXFA_LocaleMgr::GetDefLocale() { + if (m_pDefLocale) + return m_pDefLocale; + + if (!m_LocaleArray.empty()) + return m_LocaleArray[0].get(); + + if (!m_XMLLocaleArray.empty()) + return m_XMLLocaleArray[0].get(); + + std::unique_ptr locale(GetLocale(m_dwDeflcid)); + m_pDefLocale = locale.get(); + if (locale) + m_XMLLocaleArray.push_back(std::move(locale)); + + return m_pDefLocale; +} + +std::unique_ptr CXFA_LocaleMgr::GetLocale(uint16_t lcid) { + switch (lcid) { + case XFA_LANGID_zh_CN: + return XFA_GetLocaleFromBuffer(g_zhCN_Locale, sizeof(g_zhCN_Locale)); + case XFA_LANGID_zh_TW: + return XFA_GetLocaleFromBuffer(g_zhTW_Locale, sizeof(g_zhTW_Locale)); + case XFA_LANGID_zh_HK: + return XFA_GetLocaleFromBuffer(g_zhHK_Locale, sizeof(g_zhHK_Locale)); + case XFA_LANGID_ja_JP: + return XFA_GetLocaleFromBuffer(g_jaJP_Locale, sizeof(g_jaJP_Locale)); + case XFA_LANGID_ko_KR: + return XFA_GetLocaleFromBuffer(g_koKR_Locale, sizeof(g_koKR_Locale)); + case XFA_LANGID_en_GB: + return XFA_GetLocaleFromBuffer(g_enGB_Locale, sizeof(g_enGB_Locale)); + case XFA_LANGID_es_LA: + return XFA_GetLocaleFromBuffer(g_esLA_Locale, sizeof(g_esLA_Locale)); + case XFA_LANGID_es_ES: + return XFA_GetLocaleFromBuffer(g_esES_Locale, sizeof(g_esES_Locale)); + case XFA_LANGID_de_DE: + return XFA_GetLocaleFromBuffer(g_deDE_Loacale, sizeof(g_deDE_Loacale)); + case XFA_LANGID_fr_FR: + return XFA_GetLocaleFromBuffer(g_frFR_Locale, sizeof(g_frFR_Locale)); + case XFA_LANGID_it_IT: + return XFA_GetLocaleFromBuffer(g_itIT_Locale, sizeof(g_itIT_Locale)); + case XFA_LANGID_pt_BR: + return XFA_GetLocaleFromBuffer(g_ptBR_Locale, sizeof(g_ptBR_Locale)); + case XFA_LANGID_nl_NL: + return XFA_GetLocaleFromBuffer(g_nlNL_Locale, sizeof(g_nlNL_Locale)); + case XFA_LANGID_ru_RU: + return XFA_GetLocaleFromBuffer(g_ruRU_Locale, sizeof(g_ruRU_Locale)); + case XFA_LANGID_en_US: + default: + return XFA_GetLocaleFromBuffer(g_enUS_Locale, sizeof(g_enUS_Locale)); + } +} + +IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( + const CFX_WideString& wsLocaleName) { + for (size_t i = 0; i < m_LocaleArray.size(); i++) { + IFX_Locale* pLocale = m_LocaleArray[i].get(); + if (pLocale->GetName() == wsLocaleName) + return pLocale; + } + if (wsLocaleName.GetLength() < 2) + return nullptr; + for (size_t i = 0; i < m_XMLLocaleArray.size(); i++) { + IFX_Locale* pLocale = m_XMLLocaleArray[i].get(); + if (pLocale->GetName() == wsLocaleName) + return pLocale; + } + uint16_t dwLangueID = XFA_GetLanguage(wsLocaleName); + std::unique_ptr pLocale(GetLocale(dwLangueID)); + IFX_Locale* pRetLocale = pLocale.get(); + if (pLocale) + m_XMLLocaleArray.push_back(std::move(pLocale)); + return pRetLocale; +} + +void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) { + m_pDefLocale = pLocale; +} + +CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { + if (!(m_dwLocaleFlags & 0x01)) { + m_wsConfigLocale.clear(); + if (pConfig) { + CXFA_Node* pChildfConfig = + pConfig->GetFirstChildByClass(XFA_Element::Acrobat); + if (!pChildfConfig) { + pChildfConfig = pConfig->GetFirstChildByClass(XFA_Element::Present); + } + CXFA_Node* pCommon = + pChildfConfig + ? pChildfConfig->GetFirstChildByClass(XFA_Element::Common) + : nullptr; + CXFA_Node* pLocale = + pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale) + : nullptr; + if (pLocale) { + pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, false); + } + } + m_dwLocaleFlags |= 0x01; + } + return m_wsConfigLocale.AsStringC(); +} diff --git a/xfa/fxfa/parser/cxfa_localemgr.h b/xfa/fxfa/parser/cxfa_localemgr.h new file mode 100644 index 0000000000..b3b9635765 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_localemgr.h @@ -0,0 +1,59 @@ +// 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 + +#ifndef XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_ +#define XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_ + +#include +#include + +#include "xfa/fgas/localization/fgas_datetime.h" +#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" + +class CXFA_Node; +class IFX_Locale; + +#define XFA_LANGID_zh_CN 0x0804 +#define XFA_LANGID_zh_TW 0x0404 +#define XFA_LANGID_zh_HK 0x0c04 +#define XFA_LANGID_ja_JP 0x0411 +#define XFA_LANGID_ko_KR 0x0412 +#define XFA_LANGID_en_US 0x0409 +#define XFA_LANGID_en_GB 0x0809 +#define XFA_LANGID_es_ES 0x0c0a +#define XFA_LANGID_es_LA 0x080a +#define XFA_LANGID_de_DE 0x0407 +#define XFA_LANGID_fr_FR 0x040c +#define XFA_LANGID_it_IT 0x0410 +#define XFA_LANGID_pt_BR 0x0416 +#define XFA_LANGID_nl_NL 0x0413 +#define XFA_LANGID_ru_RU 0x0419 + +class CXFA_LocaleMgr { + public: + CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); + ~CXFA_LocaleMgr(); + + uint16_t GetDefLocaleID() const; + IFX_Locale* GetDefLocale(); + IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName); + + void SetDefLocale(IFX_Locale* pLocale); + CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); + + private: + std::unique_ptr GetLocale(uint16_t lcid); + + std::vector> m_LocaleArray; + std::vector> m_XMLLocaleArray; + IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray. + CFX_WideString m_wsConfigLocale; + uint16_t m_dwDeflcid; + uint16_t m_dwLocaleFlags; +}; + +#endif // XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_ diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp new file mode 100644 index 0000000000..189d7d9605 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_localevalue.cpp @@ -0,0 +1,982 @@ +// 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/parser/cxfa_localevalue.h" + +#include + +#include "core/fxcrt/fx_ext.h" +#include "third_party/base/ptr_util.h" +#include "third_party/base/stl_util.h" +#include "xfa/fgas/localization/cfx_formatstring.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +CXFA_LocaleValue::CXFA_LocaleValue() { + m_dwType = XFA_VT_NULL; + m_bValid = true; + m_pLocaleMgr = nullptr; +} +CXFA_LocaleValue::CXFA_LocaleValue(const CXFA_LocaleValue& value) { + m_dwType = XFA_VT_NULL; + m_bValid = true; + m_pLocaleMgr = nullptr; + *this = value; +} +CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, + CXFA_LocaleMgr* pLocaleMgr) { + m_dwType = dwType; + m_bValid = (m_dwType != XFA_VT_NULL); + m_pLocaleMgr = pLocaleMgr; +} +CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, + const CFX_WideString& wsValue, + CXFA_LocaleMgr* pLocaleMgr) { + m_wsValue = wsValue; + m_dwType = dwType; + m_pLocaleMgr = pLocaleMgr; + m_bValid = ValidateCanonicalValue(wsValue, dwType); +} +CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, + const CFX_WideString& wsValue, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + CXFA_LocaleMgr* pLocaleMgr) { + m_pLocaleMgr = pLocaleMgr; + m_bValid = true; + m_dwType = dwType; + m_bValid = ParsePatternValue(wsValue, wsFormat, pLocale); +} +CXFA_LocaleValue& CXFA_LocaleValue::operator=(const CXFA_LocaleValue& value) { + m_wsValue = value.m_wsValue; + m_dwType = value.m_dwType; + m_bValid = value.m_bValid; + m_pLocaleMgr = value.m_pLocaleMgr; + return *this; +} +CXFA_LocaleValue::~CXFA_LocaleValue() {} +static FX_LOCALECATEGORY XFA_ValugeCategory(FX_LOCALECATEGORY eCategory, + uint32_t dwValueType) { + if (eCategory == FX_LOCALECATEGORY_Unknown) { + switch (dwValueType) { + case XFA_VT_BOOLEAN: + case XFA_VT_INTEGER: + case XFA_VT_DECIMAL: + case XFA_VT_FLOAT: + return FX_LOCALECATEGORY_Num; + case XFA_VT_TEXT: + return FX_LOCALECATEGORY_Text; + case XFA_VT_DATE: + return FX_LOCALECATEGORY_Date; + case XFA_VT_TIME: + return FX_LOCALECATEGORY_Time; + case XFA_VT_DATETIME: + return FX_LOCALECATEGORY_DateTime; + } + } + return eCategory; +} + +bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, + const CFX_WideString& wsPattern, + IFX_Locale* pLocale, + CFX_WideString* pMatchFormat) { + CFX_WideString wsOutput; + IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); + if (pLocale) + m_pLocaleMgr->SetDefLocale(pLocale); + + auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); + std::vector wsPatterns; + pFormat->SplitFormatString(wsPattern, wsPatterns); + + bool bRet = false; + int32_t iCount = pdfium::CollectionSize(wsPatterns); + int32_t i = 0; + for (; i < iCount && !bRet; i++) { + CFX_WideString wsFormat = wsPatterns[i]; + FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); + eCategory = XFA_ValugeCategory(eCategory, m_dwType); + switch (eCategory) { + case FX_LOCALECATEGORY_Null: + bRet = pFormat->ParseNull(wsValue, wsFormat); + if (!bRet) { + bRet = wsValue.IsEmpty(); + } + break; + case FX_LOCALECATEGORY_Zero: + bRet = pFormat->ParseZero(wsValue, wsFormat); + if (!bRet) { + bRet = wsValue == L"0"; + } + break; + case FX_LOCALECATEGORY_Num: { + CFX_WideString fNum; + bRet = pFormat->ParseNum(wsValue, wsFormat, fNum); + if (!bRet) { + bRet = pFormat->FormatNum(wsValue, wsFormat, wsOutput); + } + break; + } + case FX_LOCALECATEGORY_Text: + bRet = pFormat->ParseText(wsValue, wsFormat, wsOutput); + wsOutput.clear(); + if (!bRet) { + bRet = pFormat->FormatText(wsValue, wsFormat, wsOutput); + } + break; + case FX_LOCALECATEGORY_Date: { + CFX_Unitime dt; + bRet = ValidateCanonicalDate(wsValue, &dt); + if (!bRet) { + bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date, + &dt); + if (!bRet) { + bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, + FX_DATETIMETYPE_Date); + } + } + break; + } + case FX_LOCALECATEGORY_Time: { + CFX_Unitime dt; + bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, + &dt); + if (!bRet) { + bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, + FX_DATETIMETYPE_Time); + } + break; + } + case FX_LOCALECATEGORY_DateTime: { + CFX_Unitime dt; + bRet = pFormat->ParseDateTime(wsValue, wsFormat, + FX_DATETIMETYPE_DateTime, &dt); + if (!bRet) { + bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, + FX_DATETIMETYPE_DateTime); + } + break; + } + default: + bRet = false; + break; + } + } + if (bRet && pMatchFormat) + *pMatchFormat = wsPatterns[i - 1]; + + if (pLocale) + m_pLocaleMgr->SetDefLocale(locale); + + return bRet; +} + +CFX_WideString CXFA_LocaleValue::GetValue() const { + return m_wsValue; +} +uint32_t CXFA_LocaleValue::GetType() const { + return m_dwType; +} +void CXFA_LocaleValue::SetValue(const CFX_WideString& wsValue, + uint32_t dwType) { + m_wsValue = wsValue; + m_dwType = dwType; +} +CFX_WideString CXFA_LocaleValue::GetText() const { + if (m_bValid && m_dwType == XFA_VT_TEXT) { + return m_wsValue; + } + return CFX_WideString(); +} +float CXFA_LocaleValue::GetNum() const { + if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || + m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { + int64_t nIntegral = 0; + uint32_t dwFractional = 0; + int32_t nExponent = 0; + int cc = 0; + bool bNegative = false, bExpSign = false; + const wchar_t* str = m_wsValue.c_str(); + int len = m_wsValue.GetLength(); + while (FXSYS_iswspace(str[cc]) && cc < len) { + cc++; + } + if (cc >= len) { + return 0; + } + if (str[0] == '+') { + cc++; + } else if (str[0] == '-') { + bNegative = true; + cc++; + } + int nIntegralLen = 0; + while (cc < len) { + if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) || + nIntegralLen > 17) { + break; + } + nIntegral = nIntegral * 10 + str[cc] - '0'; + cc++; + nIntegralLen++; + } + nIntegral = bNegative ? -nIntegral : nIntegral; + int scale = 0; + double fraction = 0.0; + if (cc < len && str[cc] == '.') { + cc++; + while (cc < len) { + fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0'); + scale++; + cc++; + if (scale == XFA_GetMaxFractionalScale() || + !FXSYS_isDecimalDigit(str[cc])) { + break; + } + } + dwFractional = (uint32_t)(fraction * 4294967296.0); + } + if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { + cc++; + if (cc < len) { + if (str[cc] == '+') { + cc++; + } else if (str[cc] == '-') { + bExpSign = true; + cc++; + } + } + while (cc < len) { + if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { + break; + } + nExponent = nExponent * 10 + str[cc] - '0'; + cc++; + } + nExponent = bExpSign ? -nExponent : nExponent; + } + float fValue = (float)(dwFractional / 4294967296.0); + fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue); + if (nExponent != 0) { + fValue *= FXSYS_pow(10, (float)nExponent); + } + return fValue; + } + return 0; +} +double CXFA_LocaleValue::GetDoubleNum() const { + if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || + m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { + int64_t nIntegral = 0; + uint32_t dwFractional = 0; + int32_t nExponent = 0; + int32_t cc = 0; + bool bNegative = false, bExpSign = false; + const wchar_t* str = m_wsValue.c_str(); + int len = m_wsValue.GetLength(); + while (FXSYS_iswspace(str[cc]) && cc < len) + cc++; + + if (cc >= len) + return 0; + if (str[0] == '+') { + cc++; + } else if (str[0] == '-') { + bNegative = true; + cc++; + } + + int32_t nIntegralLen = 0; + while (cc < len) { + if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) || + nIntegralLen > 17) { + break; + } + nIntegral = nIntegral * 10 + str[cc] - '0'; + cc++; + nIntegralLen++; + } + nIntegral = bNegative ? -nIntegral : nIntegral; + int32_t scale = 0; + double fraction = 0.0; + if (cc < len && str[cc] == '.') { + cc++; + while (cc < len) { + fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0'); + scale++; + cc++; + if (scale == XFA_GetMaxFractionalScale() || + !FXSYS_isDecimalDigit(str[cc])) { + break; + } + } + dwFractional = static_cast(fraction * 4294967296.0); + } + if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { + cc++; + if (cc < len) { + if (str[cc] == '+') { + cc++; + } else if (str[cc] == '-') { + bExpSign = true; + cc++; + } + } + while (cc < len) { + if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) + break; + + nExponent = nExponent * 10 + str[cc] - '0'; + cc++; + } + nExponent = bExpSign ? -nExponent : nExponent; + } + + double dValue = dwFractional / 4294967296.0; + dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); + if (nExponent != 0) + dValue *= FXSYS_pow(10, static_cast(nExponent)); + + return dValue; + } + return 0; +} + +CFX_Unitime CXFA_LocaleValue::GetDate() const { + if (m_bValid && m_dwType == XFA_VT_DATE) { + CFX_Unitime dt; + FX_DateFromCanonical(m_wsValue, &dt); + return dt; + } + return CFX_Unitime(); +} + +CFX_Unitime CXFA_LocaleValue::GetTime() const { + if (m_bValid && m_dwType == XFA_VT_TIME) { + ASSERT(m_pLocaleMgr); + + CFX_Unitime dt; + FX_TimeFromCanonical(m_wsValue.AsStringC(), &dt, + m_pLocaleMgr->GetDefLocale()); + return dt; + } + return CFX_Unitime(); +} + +CFX_Unitime CXFA_LocaleValue::GetDateTime() const { + if (m_bValid && m_dwType == XFA_VT_DATETIME) { + int32_t index = m_wsValue.Find('T'); + CFX_Unitime dt; + FX_DateFromCanonical(m_wsValue.Left(index), &dt); + ASSERT(m_pLocaleMgr); + FX_TimeFromCanonical( + m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsStringC(), &dt, + m_pLocaleMgr->GetDefLocale()); + return dt; + } + return CFX_Unitime(); +} + +bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText) { + m_dwType = XFA_VT_TEXT; + m_wsValue = wsText; + return true; +} + +bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale) { + m_dwType = XFA_VT_TEXT; + return m_bValid = ParsePatternValue(wsText, wsFormat, pLocale); +} + +bool CXFA_LocaleValue::SetNum(float fNum) { + m_dwType = XFA_VT_FLOAT; + m_wsValue.Format(L"%.8g", static_cast(fNum)); + return true; +} + +bool CXFA_LocaleValue::SetNum(const CFX_WideString& wsNum, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale) { + m_dwType = XFA_VT_FLOAT; + return m_bValid = ParsePatternValue(wsNum, wsFormat, pLocale); +} + +bool CXFA_LocaleValue::SetDate(const CFX_Unitime& d) { + m_dwType = XFA_VT_DATE; + m_wsValue.Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(), d.GetDay()); + return true; +} + +bool CXFA_LocaleValue::SetDate(const CFX_WideString& wsDate, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale) { + m_dwType = XFA_VT_DATE; + return m_bValid = ParsePatternValue(wsDate, wsFormat, pLocale); +} + +bool CXFA_LocaleValue::SetTime(const CFX_Unitime& t) { + m_dwType = XFA_VT_TIME; + m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(), + t.GetSecond()); + if (t.GetMillisecond() > 0) { + CFX_WideString wsTemp; + wsTemp.Format(L"%:03d", t.GetMillisecond()); + m_wsValue += wsTemp; + } + return true; +} + +bool CXFA_LocaleValue::SetTime(const CFX_WideString& wsTime, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale) { + m_dwType = XFA_VT_TIME; + return m_bValid = ParsePatternValue(wsTime, wsFormat, pLocale); +} + +bool CXFA_LocaleValue::SetDateTime(const CFX_Unitime& dt) { + m_dwType = XFA_VT_DATETIME; + m_wsValue.Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(), + dt.GetMonth(), dt.GetDay(), dt.GetHour(), dt.GetMinute(), + dt.GetSecond()); + if (dt.GetMillisecond() > 0) { + CFX_WideString wsTemp; + wsTemp.Format(L"%:03d", dt.GetMillisecond()); + m_wsValue += wsTemp; + } + return true; +} + +bool CXFA_LocaleValue::SetDateTime(const CFX_WideString& wsDateTime, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale) { + m_dwType = XFA_VT_DATETIME; + return m_bValid = ParsePatternValue(wsDateTime, wsFormat, pLocale); +} + +bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + XFA_VALUEPICTURE eValueType) const { + auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); + std::vector wsPatterns; + pFormat->SplitFormatString(wsFormat, wsPatterns); + wsResult.clear(); + int32_t iCount = pdfium::CollectionSize(wsPatterns); + for (int32_t i = 0; i < iCount; i++) { + if (FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType)) + return true; + } + return false; +} + +bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + XFA_VALUEPICTURE eValueType) const { + IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); + if (pLocale) + m_pLocaleMgr->SetDefLocale(pLocale); + + wsResult.clear(); + bool bRet = false; + auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); + FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); + eCategory = XFA_ValugeCategory(eCategory, m_dwType); + switch (eCategory) { + case FX_LOCALECATEGORY_Null: + if (m_wsValue.IsEmpty()) { + bRet = pFormat->FormatNull(wsFormat, wsResult); + } + break; + case FX_LOCALECATEGORY_Zero: + if (m_wsValue == L"0") { + bRet = pFormat->FormatZero(wsFormat, wsResult); + } + break; + case FX_LOCALECATEGORY_Num: + bRet = pFormat->FormatNum(m_wsValue, wsFormat, wsResult); + break; + case FX_LOCALECATEGORY_Text: + bRet = pFormat->FormatText(m_wsValue, wsFormat, wsResult); + break; + case FX_LOCALECATEGORY_Date: + bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult, + FX_DATETIMETYPE_Date); + break; + case FX_LOCALECATEGORY_Time: + bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult, + FX_DATETIMETYPE_Time); + break; + case FX_LOCALECATEGORY_DateTime: + bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult, + FX_DATETIMETYPE_DateTime); + break; + default: + wsResult = m_wsValue; + bRet = true; + } + if (!bRet && (eCategory != FX_LOCALECATEGORY_Num || + eValueType != XFA_VALUEPICTURE_Display)) { + wsResult = m_wsValue; + } + if (pLocale) + m_pLocaleMgr->SetDefLocale(locale); + + return bRet; +} + +static bool XFA_ValueSplitDateTime(const CFX_WideString& wsDateTime, + CFX_WideString& wsDate, + CFX_WideString& wsTime) { + wsDate = L""; + wsTime = L""; + if (wsDateTime.IsEmpty()) { + return false; + } + int nSplitIndex = -1; + nSplitIndex = wsDateTime.Find('T'); + if (nSplitIndex < 0) { + nSplitIndex = wsDateTime.Find(' '); + } + if (nSplitIndex < 0) { + return false; + } + wsDate = wsDateTime.Left(nSplitIndex); + wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1); + return true; +} +bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, + uint32_t dwVType) { + if (wsValue.IsEmpty()) { + return true; + } + CFX_Unitime dt; + switch (dwVType) { + case XFA_VT_DATE: { + if (ValidateCanonicalDate(wsValue, &dt)) + return true; + + CFX_WideString wsDate, wsTime; + if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) && + ValidateCanonicalDate(wsDate, &dt)) { + return true; + } + return false; + } + case XFA_VT_TIME: { + if (ValidateCanonicalTime(wsValue)) + return true; + + CFX_WideString wsDate, wsTime; + if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) && + ValidateCanonicalTime(wsTime)) { + return true; + } + return false; + } + case XFA_VT_DATETIME: { + CFX_WideString wsDate, wsTime; + if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) && + ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime)) { + return true; + } + } break; + } + return true; +} +bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, + CFX_Unitime* unDate) { + const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + const uint16_t wCountY = 4, wCountM = 2, wCountD = 2; + int nLen = wsDate.GetLength(); + if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { + return false; + } + const bool bSymbol = wsDate.Find(0x2D) != -1; + uint16_t wYear = 0; + uint16_t wMonth = 0; + uint16_t wDay = 0; + const wchar_t* pDate = wsDate.c_str(); + int nIndex = 0, nStart = 0; + while (pDate[nIndex] != '\0' && nIndex < wCountY) { + if (!FXSYS_isDecimalDigit(pDate[nIndex])) { + return false; + } + wYear = (pDate[nIndex] - '0') + wYear * 10; + nIndex++; + } + if (bSymbol) { + if (pDate[nIndex] != 0x2D) { + return false; + } + nIndex++; + } + nStart = nIndex; + while (pDate[nIndex] != '\0' && nIndex - nStart < wCountM && nIndex < nLen) { + if (!FXSYS_isDecimalDigit(pDate[nIndex])) { + return false; + } + wMonth = (pDate[nIndex] - '0') + wMonth * 10; + nIndex++; + } + if (bSymbol) { + if (pDate[nIndex] != 0x2D) { + return false; + } + nIndex++; + } + nStart = nIndex; + while (pDate[nIndex] != '\0' && nIndex - nStart < wCountD && nIndex < nLen) { + if (!FXSYS_isDecimalDigit(pDate[nIndex])) { + return false; + } + wDay = (pDate[nIndex] - '0') + wDay * 10; + nIndex++; + } + if (nIndex != nLen) { + return false; + } + if (wYear < 1900 || wYear > 2029) { + return false; + } + if (wMonth < 1 || wMonth > 12) { + if (wMonth == 0 && nLen == wCountY) { + return true; + } + return false; + } + if (wDay < 1) { + if (wDay == 0 && (nLen == wCountY + wCountM)) { + return true; + } + return false; + } + if (wMonth == 2) { + if (wYear % 400 == 0 || (wYear % 100 != 0 && wYear % 4 == 0)) { + if (wDay > 29) { + return false; + } + } else { + if (wDay > 28) { + return false; + } + } + } else if (wDay > LastDay[wMonth - 1]) { + return false; + } + + unDate->SetDate(wYear, static_cast(wMonth), + static_cast(wDay)); + return true; +} + +bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { + int nLen = wsTime.GetLength(); + if (nLen < 2) + return false; + const uint16_t wCountH = 2; + const uint16_t wCountM = 2; + const uint16_t wCountS = 2; + const uint16_t wCountF = 3; + const bool bSymbol = wsTime.Find(':') != -1; + uint16_t wHour = 0; + uint16_t wMinute = 0; + uint16_t wSecond = 0; + uint16_t wFraction = 0; + const wchar_t* pTime = wsTime.c_str(); + int nIndex = 0; + int nStart = 0; + while (nIndex - nStart < wCountH && pTime[nIndex]) { + if (!FXSYS_isDecimalDigit(pTime[nIndex])) + return false; + wHour = pTime[nIndex] - '0' + wHour * 10; + nIndex++; + } + if (bSymbol) { + if (nIndex < nLen && pTime[nIndex] != ':') + return false; + nIndex++; + } + nStart = nIndex; + while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { + if (!FXSYS_isDecimalDigit(pTime[nIndex])) + return false; + wMinute = pTime[nIndex] - '0' + wMinute * 10; + nIndex++; + } + if (bSymbol) { + if (nIndex < nLen && pTime[nIndex] != ':') + return false; + nIndex++; + } + nStart = nIndex; + while (nIndex - nStart < wCountS && nIndex < nLen && pTime[nIndex]) { + if (!FXSYS_isDecimalDigit(pTime[nIndex])) + return false; + wSecond = pTime[nIndex] - '0' + wSecond * 10; + nIndex++; + } + if (wsTime.Find('.') > 0) { + if (pTime[nIndex] != '.') + return false; + nIndex++; + nStart = nIndex; + while (nIndex - nStart < wCountF && nIndex < nLen && pTime[nIndex]) { + if (!FXSYS_isDecimalDigit(pTime[nIndex])) + return false; + wFraction = pTime[nIndex] - '0' + wFraction * 10; + nIndex++; + } + } + if (nIndex < nLen) { + if (pTime[nIndex] == 'Z') { + nIndex++; + } else if (pTime[nIndex] == '-' || pTime[nIndex] == '+') { + int16_t nOffsetH = 0; + int16_t nOffsetM = 0; + nIndex++; + nStart = nIndex; + while (nIndex - nStart < wCountH && nIndex < nLen && pTime[nIndex]) { + if (!FXSYS_isDecimalDigit(pTime[nIndex])) + return false; + nOffsetH = pTime[nIndex] - '0' + nOffsetH * 10; + nIndex++; + } + if (bSymbol) { + if (nIndex < nLen && pTime[nIndex] != ':') + return false; + nIndex++; + } + nStart = nIndex; + while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { + if (!FXSYS_isDecimalDigit(pTime[nIndex])) + return false; + nOffsetM = pTime[nIndex] - '0' + nOffsetM * 10; + nIndex++; + } + if (nOffsetH > 12 || nOffsetM >= 60) + return false; + } + } + return nIndex == nLen && wHour < 24 && wMinute < 60 && wSecond < 60 && + wFraction <= 999; +} + +bool CXFA_LocaleValue::ValidateCanonicalDateTime( + const CFX_WideString& wsDateTime) { + CFX_WideString wsDate, wsTime; + if (wsDateTime.IsEmpty()) + return false; + + int nSplitIndex = -1; + nSplitIndex = wsDateTime.Find('T'); + if (nSplitIndex < 0) + nSplitIndex = wsDateTime.Find(' '); + if (nSplitIndex < 0) + return false; + + wsDate = wsDateTime.Left(nSplitIndex); + wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1); + CFX_Unitime dt; + return ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime); +} + +bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, + const CFX_WideString& wsPattern, + IFX_Locale* pLocale) { + IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); + if (pLocale) + m_pLocaleMgr->SetDefLocale(pLocale); + + auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); + std::vector wsPatterns; + pFormat->SplitFormatString(wsPattern, wsPatterns); + bool bRet = false; + int32_t iCount = pdfium::CollectionSize(wsPatterns); + for (int32_t i = 0; i < iCount && !bRet; i++) { + CFX_WideString wsFormat = wsPatterns[i]; + FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); + eCategory = XFA_ValugeCategory(eCategory, m_dwType); + switch (eCategory) { + case FX_LOCALECATEGORY_Null: + bRet = pFormat->ParseNull(wsValue, wsFormat); + if (bRet) { + m_wsValue.clear(); + } + break; + case FX_LOCALECATEGORY_Zero: + bRet = pFormat->ParseZero(wsValue, wsFormat); + if (bRet) + m_wsValue = L"0"; + break; + case FX_LOCALECATEGORY_Num: { + CFX_WideString fNum; + bRet = pFormat->ParseNum(wsValue, wsFormat, fNum); + if (bRet) { + m_wsValue = fNum; + } + break; + } + case FX_LOCALECATEGORY_Text: + bRet = pFormat->ParseText(wsValue, wsFormat, m_wsValue); + break; + case FX_LOCALECATEGORY_Date: { + CFX_Unitime dt; + bRet = ValidateCanonicalDate(wsValue, &dt); + if (!bRet) { + bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date, + &dt); + } + if (bRet) + SetDate(dt); + break; + } + case FX_LOCALECATEGORY_Time: { + CFX_Unitime dt; + bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, + &dt); + if (bRet) + SetTime(dt); + break; + } + case FX_LOCALECATEGORY_DateTime: { + CFX_Unitime dt; + bRet = pFormat->ParseDateTime(wsValue, wsFormat, + FX_DATETIMETYPE_DateTime, &dt); + if (bRet) + SetDateTime(dt); + break; + } + default: + m_wsValue = wsValue; + bRet = true; + break; + } + } + if (!bRet) + m_wsValue = wsValue; + + if (pLocale) + m_pLocaleMgr->SetDefLocale(locale); + + return bRet; +} + +void CXFA_LocaleValue::GetNumbericFormat(CFX_WideString& wsFormat, + int32_t nIntLen, + int32_t nDecLen, + bool bSign) { + ASSERT(wsFormat.IsEmpty()); + ASSERT(nIntLen >= -1 && nDecLen >= -1); + int32_t nTotalLen = (nIntLen >= 0 ? nIntLen : 2) + (bSign ? 1 : 0) + + (nDecLen >= 0 ? nDecLen : 2) + (nDecLen == 0 ? 0 : 1); + wchar_t* lpBuf = wsFormat.GetBuffer(nTotalLen); + int32_t nPos = 0; + if (bSign) { + lpBuf[nPos++] = L's'; + } + if (nIntLen == -1) { + lpBuf[nPos++] = L'z'; + lpBuf[nPos++] = L'*'; + } else { + while (nIntLen) { + lpBuf[nPos++] = L'z'; + nIntLen--; + } + } + if (nDecLen != 0) { + lpBuf[nPos++] = L'.'; + } + if (nDecLen == -1) { + lpBuf[nPos++] = L'z'; + lpBuf[nPos++] = L'*'; + } else { + while (nDecLen) { + lpBuf[nPos++] = L'z'; + nDecLen--; + } + } + wsFormat.ReleaseBuffer(nTotalLen); +} +bool CXFA_LocaleValue::ValidateNumericTemp(CFX_WideString& wsNumeric, + CFX_WideString& wsFormat, + IFX_Locale* pLocale, + int32_t* pos) { + if (wsFormat.IsEmpty() || wsNumeric.IsEmpty()) { + return true; + } + const wchar_t* pNum = wsNumeric.c_str(); + const wchar_t* pFmt = wsFormat.c_str(); + int32_t n = 0, nf = 0; + wchar_t c = pNum[n]; + wchar_t cf = pFmt[nf]; + if (cf == L's') { + if (c == L'-' || c == L'+') { + ++n; + } + ++nf; + } + bool bLimit = true; + int32_t nCount = wsNumeric.GetLength(); + int32_t nCountFmt = wsFormat.GetLength(); + while (n < nCount && (bLimit ? nf < nCountFmt : true) && + FXSYS_isDecimalDigit(c = pNum[n])) { + if (bLimit == true) { + if ((cf = pFmt[nf]) == L'*') { + bLimit = false; + } else if (cf == L'z') { + nf++; + } else { + return false; + } + } + n++; + } + if (n == nCount) { + return true; + } + if (nf == nCountFmt) { + return false; + } + while (nf < nCountFmt && (cf = pFmt[nf]) != L'.') { + ASSERT(cf == L'z' || cf == L'*'); + ++nf; + } + CFX_WideString wsDecimalSymbol; + if (pLocale) { + pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDecimalSymbol); + } else { + wsDecimalSymbol = CFX_WideString(L'.'); + } + if (pFmt[nf] != L'.') { + return false; + } + if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.') { + return false; + } + ++nf; + ++n; + bLimit = true; + while (n < nCount && (bLimit ? nf < nCountFmt : true) && + FXSYS_isDecimalDigit(c = pNum[n])) { + if (bLimit == true) { + if ((cf = pFmt[nf]) == L'*') { + bLimit = false; + } else if (cf == L'z') { + nf++; + } else { + return false; + } + } + n++; + } + return n == nCount; +} diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h new file mode 100644 index 0000000000..75687b4281 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_localevalue.h @@ -0,0 +1,112 @@ +// 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 + +#ifndef XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_ +#define XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_ + +#include "core/fxcrt/fx_string.h" +#include "core/fxcrt/fx_system.h" +#include "xfa/fxfa/parser/cxfa_widgetdata.h" + +class IFX_Locale; +class CFX_Unitime; +class CXFA_LocaleMgr; + +#define XFA_VT_NULL 0 +#define XFA_VT_BOOLEAN 1 +#define XFA_VT_INTEGER 2 +#define XFA_VT_DECIMAL 4 +#define XFA_VT_FLOAT 8 +#define XFA_VT_TEXT 16 +#define XFA_VT_DATE 32 +#define XFA_VT_TIME 64 +#define XFA_VT_DATETIME 128 + +class CXFA_LocaleValue { + public: + CXFA_LocaleValue(); + CXFA_LocaleValue(const CXFA_LocaleValue& value); + CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr); + CXFA_LocaleValue(uint32_t dwType, + const CFX_WideString& wsValue, + CXFA_LocaleMgr* pLocaleMgr); + CXFA_LocaleValue(uint32_t dwType, + const CFX_WideString& wsValue, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + CXFA_LocaleMgr* pLocaleMgr); + ~CXFA_LocaleValue(); + CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); + + bool ValidateValue(const CFX_WideString& wsValue, + const CFX_WideString& wsPattern, + IFX_Locale* pLocale, + CFX_WideString* pMatchFormat = nullptr); + bool FormatPatterns(CFX_WideString& wsResult, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + XFA_VALUEPICTURE eValueType) const; + bool FormatSinglePattern(CFX_WideString& wsResult, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + XFA_VALUEPICTURE eValueType) const; + bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType); + bool ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime* unDate); + bool ValidateCanonicalTime(const CFX_WideString& wsTime); + bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime); + void GetNumbericFormat(CFX_WideString& wsFormat, + int32_t nIntLen, + int32_t nDecLen, + bool bSign = true); + bool ValidateNumericTemp(CFX_WideString& wsNumeric, + CFX_WideString& wsFormat, + IFX_Locale* pLocale = nullptr, + int32_t* pos = nullptr); + + CFX_WideString GetValue() const; + uint32_t GetType() const; + void SetValue(const CFX_WideString& wsValue, uint32_t dwType); + CFX_WideString GetText() const; + float GetNum() const; + double GetDoubleNum() const; + CFX_Unitime GetDate() const; + CFX_Unitime GetTime() const; + CFX_Unitime GetDateTime() const; + bool SetText(const CFX_WideString& wsText); + bool SetText(const CFX_WideString& wsText, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + bool SetNum(float fNum); + bool SetNum(const CFX_WideString& wsNum, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + bool SetDate(const CFX_Unitime& d); + bool SetDate(const CFX_WideString& wsDate, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + bool SetTime(const CFX_Unitime& t); + bool SetTime(const CFX_WideString& wsTime, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + bool SetDateTime(const CFX_Unitime& dt); + bool SetDateTime(const CFX_WideString& wsDateTime, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + bool IsNull() const { return m_dwType == XFA_VT_NULL; } + bool IsEmpty() const { return m_wsValue.IsEmpty(); } + bool IsValid() const { return m_bValid; } + + private: + bool ParsePatternValue(const CFX_WideString& wsValue, + const CFX_WideString& wsPattern, + IFX_Locale* pLocale); + CXFA_LocaleMgr* m_pLocaleMgr; + CFX_WideString m_wsValue; + uint32_t m_dwType; + bool m_bValid; +}; + +#endif // XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_ diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index 692f0b2338..6a9904af04 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -8,8 +8,8 @@ #include "core/fxcrt/fx_ext.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp new file mode 100644 index 0000000000..49d55c884c --- /dev/null +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -0,0 +1,193 @@ +// 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/parser/cxfa_nodelocale.h" + +#include + +#include "core/fxcrt/fx_xml.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_timezoneprovider.h" +#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +namespace { + +const wchar_t g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%"; +const wchar_t g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99"; +const wchar_t g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz"; +const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz"; + +} // namespace + +CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) { + switch (category) { + case FX_LOCALENUMPATTERN_Percent: + return g_FX_Percent; + case FX_LOCALENUMPATTERN_Currency: + return g_FX_Currency; + case FX_LOCALENUMPATTERN_Decimal: + return g_FX_Decimal; + case FX_LOCALENUMPATTERN_Integer: + return g_FX_Integer; + } + return L""; +} + +CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {} + +CXFA_NodeLocale::~CXFA_NodeLocale() {} + +CFX_WideString CXFA_NodeLocale::GetName() const { + return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name) + : nullptr); +} + +void CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const { + switch (eType) { + case FX_LOCALENUMSYMBOL_Decimal: + wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"decimal"); + break; + case FX_LOCALENUMSYMBOL_Grouping: + wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"grouping"); + break; + case FX_LOCALENUMSYMBOL_Percent: + wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"percent"); + break; + case FX_LOCALENUMSYMBOL_Minus: + wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"minus"); + break; + case FX_LOCALENUMSYMBOL_Zero: + wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"zero"); + break; + case FX_LOCALENUMSYMBOL_CurrencySymbol: + wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"symbol"); + break; + case FX_LOCALENUMSYMBOL_CurrencyName: + wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"isoname"); + break; + } +} + +void CXFA_NodeLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { + CXFA_Node* pSymbols = + m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols) + : nullptr; + wsDtSymbol = pSymbols ? pSymbols->GetContent() : CFX_WideString(); +} + +void CXFA_NodeLocale::GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + bool bAbbr) const { + wsMonthName = GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr); +} + +void CXFA_NodeLocale::GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + bool bAbbr) const { + wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr); +} + +void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, + bool bAM) const { + wsMeridiemName = + GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false); +} + +void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE* tz) const { + CXFA_TimeZoneProvider provider; + provider.GetTimeZone(tz); +} + +void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { + wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false); +} + +void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const { + switch (eType) { + case FX_LOCALEDATETIMESUBCATEGORY_Short: + wsPattern = GetSymbol(XFA_Element::DatePatterns, L"short"); + break; + case FX_LOCALEDATETIMESUBCATEGORY_Medium: + case FX_LOCALEDATETIMESUBCATEGORY_Default: + wsPattern = GetSymbol(XFA_Element::DatePatterns, L"med"); + break; + case FX_LOCALEDATETIMESUBCATEGORY_Full: + wsPattern = GetSymbol(XFA_Element::DatePatterns, L"full"); + break; + case FX_LOCALEDATETIMESUBCATEGORY_Long: + wsPattern = GetSymbol(XFA_Element::DatePatterns, L"long"); + break; + } +} + +void CXFA_NodeLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const { + switch (eType) { + case FX_LOCALEDATETIMESUBCATEGORY_Short: + wsPattern = GetSymbol(XFA_Element::TimePatterns, L"short"); + break; + case FX_LOCALEDATETIMESUBCATEGORY_Medium: + case FX_LOCALEDATETIMESUBCATEGORY_Default: + wsPattern = GetSymbol(XFA_Element::TimePatterns, L"med"); + break; + case FX_LOCALEDATETIMESUBCATEGORY_Full: + wsPattern = GetSymbol(XFA_Element::TimePatterns, L"full"); + break; + case FX_LOCALEDATETIMESUBCATEGORY_Long: + wsPattern = GetSymbol(XFA_Element::TimePatterns, L"long"); + break; + } +} + +void CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const { + wsPattern = XFA_PatternToString(eType); +} + +CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, + const CFX_WideStringC& wsName) const { + CXFA_Node* pChild = + pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; + while (pChild) { + CFX_WideString wsChild; + if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) { + if (wsChild == wsName) + return pChild; + } + pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); + } + return nullptr; +} + +CFX_WideString CXFA_NodeLocale::GetSymbol( + XFA_Element eElement, + const CFX_WideStringC& symbol_type) const { + CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr; + CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type); + return pSymbol ? pSymbol->GetContent() : CFX_WideString(); +} + +CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, + int index, + bool bAbbr) const { + CXFA_Node* pCalendar = + m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols) + : nullptr; + if (pCalendar) { + CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); + for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { + if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { + CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown); + return pSymbol ? pSymbol->GetContent() : CFX_WideString(); + } + } + } + return CFX_WideString(); +} diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h new file mode 100644 index 0000000000..db3b2303e7 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_nodelocale.h @@ -0,0 +1,58 @@ +// 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 + +#ifndef XFA_FXFA_PARSER_CXFA_NODELOCALE_H_ +#define XFA_FXFA_PARSER_CXFA_NODELOCALE_H_ + +#include + +#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fxfa/parser/xfa_object.h" + +CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category); + +class CXFA_NodeLocale : public IFX_Locale { + public: + explicit CXFA_NodeLocale(CXFA_Node* pLocale); + ~CXFA_NodeLocale() override; + + // IFX_Locale + CFX_WideString GetName() const override; + void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const override; + + void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; + void GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + bool bAbbr = true) const override; + void GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + bool bAbbr = true) const override; + void GetMeridiemName(CFX_WideString& wsMeridiemName, + bool bAM = true) const override; + void GetTimeZone(FX_TIMEZONE* tz) const override; + void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override; + + void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + + private: + CXFA_Node* GetNodeByName(CXFA_Node* pParent, + const CFX_WideStringC& wsName) const; + CFX_WideString GetSymbol(XFA_Element eElement, + const CFX_WideStringC& symbol_type) const; + CFX_WideString GetCalendarSymbol(XFA_Element eElement, + int index, + bool bAbbr) const; + + CXFA_Node* const m_pLocale; +}; + +#endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_ diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 184cebb120..391e63aac5 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -14,9 +14,9 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index 03fd128332..d62027ef03 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -17,10 +17,10 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp new file mode 100644 index 0000000000..65ce61e10b --- /dev/null +++ b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp @@ -0,0 +1,36 @@ +// Copyright 2017 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/parser/cxfa_timezoneprovider.h" + +#include + +static bool g_bProviderTimeZoneSet = false; + +CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ + if (!g_bProviderTimeZoneSet) { + g_bProviderTimeZoneSet = true; + _tzset(); + } + m_tz.tzHour = static_cast(_timezone / 3600 * -1); + m_tz.tzMinute = static_cast((FXSYS_abs(_timezone) % 3600) / 60); +#else + if (!g_bProviderTimeZoneSet) { + g_bProviderTimeZoneSet = true; + tzset(); + } + m_tz.tzHour = static_cast(timezone / 3600 * -1); + m_tz.tzMinute = + static_cast((FXSYS_abs(static_cast(timezone)) % 3600) / 60); +#endif +} + +CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} + +void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE* tz) const { + *tz = m_tz; +} diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.h b/xfa/fxfa/parser/cxfa_timezoneprovider.h new file mode 100644 index 0000000000..05230cc122 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_timezoneprovider.h @@ -0,0 +1,23 @@ +// Copyright 2017 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 + +#ifndef XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_ +#define XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_ + +#include "xfa/fgas/localization/fgas_datetime.h" + +class CXFA_TimeZoneProvider { + public: + CXFA_TimeZoneProvider(); + ~CXFA_TimeZoneProvider(); + + void GetTimeZone(FX_TIMEZONE* tz) const; + + private: + FX_TIMEZONE m_tz; +}; + +#endif // XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index a314bec2b8..e6cd75fe62 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -12,8 +12,8 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_event.h" +#include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_object.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp new file mode 100644 index 0000000000..c4aae15020 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp @@ -0,0 +1,209 @@ +// Copyright 2017 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/parser/cxfa_xmllocale.h" + +#include + +#include "core/fxcrt/fx_xml.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_nodelocale.h" +#include "xfa/fxfa/parser/cxfa_timezoneprovider.h" +#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr pLocaleData) + : m_pLocaleData(std::move(pLocaleData)) {} + +CXFA_XMLLocale::~CXFA_XMLLocale() {} + +CFX_WideString CXFA_XMLLocale::GetName() const { + return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString(); +} + +void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const { + CFX_ByteString bsSymbols; + CFX_WideString wsName; + switch (eType) { + case FX_LOCALENUMSYMBOL_Decimal: + bsSymbols = "numberSymbols"; + wsName = L"decimal"; + break; + case FX_LOCALENUMSYMBOL_Grouping: + bsSymbols = "numberSymbols"; + wsName = L"grouping"; + break; + case FX_LOCALENUMSYMBOL_Percent: + bsSymbols = "numberSymbols"; + wsName = L"percent"; + break; + case FX_LOCALENUMSYMBOL_Minus: + bsSymbols = "numberSymbols"; + wsName = L"minus"; + break; + case FX_LOCALENUMSYMBOL_Zero: + bsSymbols = "numberSymbols"; + wsName = L"zero"; + break; + case FX_LOCALENUMSYMBOL_CurrencySymbol: + bsSymbols = "currencySymbols"; + wsName = L"symbol"; + break; + case FX_LOCALENUMSYMBOL_CurrencyName: + bsSymbols = "currencySymbols"; + wsName = L"isoname"; + break; + default: + return; + } + CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC()); + if (!pElement) + return; + + GetPattern(pElement, + CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1), + wsName.AsStringC(), wsNumSymbol); +} + +void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { + if (!m_pLocaleData) + return; + + CFX_ByteString bsSpace; + CXML_Element* pNumberSymbols = + m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols"); + if (!pNumberSymbols) + return; + + wsDtSymbol = pNumberSymbols->GetContent(0); +} + +void CXFA_XMLLocale::GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + bool bAbbr) const { + wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr); +} + +void CXFA_XMLLocale::GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + bool bAbbr) const { + wsDayName = GetCalendarSymbol("day", nWeek, bAbbr); +} + +void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, + bool bAM) const { + wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false); +} + +void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE* tz) const { + CXFA_TimeZoneProvider provider; + provider.GetTimeZone(tz); +} + +void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { + wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false); +} + +CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, + int index, + bool bAbbr) const { + CFX_ByteString pstrSymbolNames = symbol + "Names"; + CFX_WideString wsSymbolName = L""; + if (m_pLocaleData) { + CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols"); + if (pChild) { + CXML_Element* pSymbolNames = + pChild->GetElement("", pstrSymbolNames.AsStringC()); + if (pSymbolNames) { + if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) { + pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1); + } + if (pSymbolNames && (!!pSymbolNames->GetAttrInteger("abbr")) == bAbbr) { + CXML_Element* pSymbolName = + pSymbolNames->GetElement("", symbol, index); + if (pSymbolName) + wsSymbolName = pSymbolName->GetContent(0); + } + } + } + } + return wsSymbolName; +} + +void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const { + CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns"); + if (!pElement) + return; + + CFX_WideString wsName; + switch (eType) { + case FX_LOCALEDATETIMESUBCATEGORY_Short: + wsName = L"short"; + break; + case FX_LOCALEDATETIMESUBCATEGORY_Default: + case FX_LOCALEDATETIMESUBCATEGORY_Medium: + wsName = L"med"; + break; + case FX_LOCALEDATETIMESUBCATEGORY_Full: + wsName = L"full"; + break; + case FX_LOCALEDATETIMESUBCATEGORY_Long: + wsName = L"long"; + break; + } + GetPattern(pElement, "datePattern", wsName.AsStringC(), wsPattern); +} + +void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const { + CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns"); + if (!pElement) + return; + + CFX_WideString wsName; + switch (eType) { + case FX_LOCALEDATETIMESUBCATEGORY_Short: + wsName = L"short"; + break; + case FX_LOCALEDATETIMESUBCATEGORY_Default: + case FX_LOCALEDATETIMESUBCATEGORY_Medium: + wsName = L"med"; + break; + case FX_LOCALEDATETIMESUBCATEGORY_Full: + wsName = L"full"; + break; + case FX_LOCALEDATETIMESUBCATEGORY_Long: + wsName = L"long"; + break; + } + GetPattern(pElement, "timePattern", wsName.AsStringC(), wsPattern); +} + +void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const { + CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns"); + if (!pElement) + return; + + wsPattern = XFA_PatternToString(eType); +} + +void CXFA_XMLLocale::GetPattern(CXML_Element* pElement, + const CFX_ByteStringC& bsTag, + const CFX_WideStringC& wsName, + CFX_WideString& wsPattern) const { + int32_t iCount = pElement->CountElements("", bsTag); + for (int32_t i = 0; i < iCount; i++) { + CXML_Element* pChild = pElement->GetElement("", bsTag, i); + if (pChild->GetAttrValue("name") == wsName) { + wsPattern = pChild->GetContent(0); + return; + } + } +} diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h new file mode 100644 index 0000000000..b631697b40 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_xmllocale.h @@ -0,0 +1,56 @@ +// 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 + +#ifndef XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_ +#define XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_ + +#include + +#include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fxfa/parser/xfa_object.h" + +class CXFA_XMLLocale : public IFX_Locale { + public: + explicit CXFA_XMLLocale(std::unique_ptr pLocaleData); + ~CXFA_XMLLocale() override; + + // IFX_Locale + CFX_WideString GetName() const override; + void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const override; + + void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; + void GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + bool bAbbr = true) const override; + void GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + bool bAbbr = true) const override; + void GetMeridiemName(CFX_WideString& wsMeridiemName, + bool bAM = true) const override; + void GetTimeZone(FX_TIMEZONE* tz) const override; + void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override; + + void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + + private: + void GetPattern(CXML_Element* pElement, + const CFX_ByteStringC& bsTag, + const CFX_WideStringC& wsName, + CFX_WideString& wsPattern) const; + CFX_WideString GetCalendarSymbol(const CFX_ByteStringC& symbol, + int index, + bool bAbbr) const; + + std::unique_ptr m_pLocaleData; +}; + +#endif // XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_ diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index b5b2f3c406..7ee11beb01 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -14,9 +14,9 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp deleted file mode 100644 index 63cd50ac19..0000000000 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ /dev/null @@ -1,2791 +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/parser/xfa_layout_itemlayout.h" - -#include -#include -#include -#include - -#include "third_party/base/ptr_util.h" -#include "third_party/base/stl_util.h" -#include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" -#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" -#include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" -#include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/cxfa_occur.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_utils.h" - -namespace { - -std::vector SeparateStringW(const wchar_t* pStr, - int32_t iStrLen, - wchar_t delimiter) { - std::vector ret; - if (!pStr) - return ret; - if (iStrLen < 0) - iStrLen = FXSYS_wcslen(pStr); - - const wchar_t* pToken = pStr; - const wchar_t* pEnd = pStr + iStrLen; - while (true) { - if (pStr >= pEnd || delimiter == *pStr) { - ret.push_back(CFX_WideString(pToken, pStr - pToken)); - pToken = pStr + 1; - if (pStr >= pEnd) - break; - } - pStr++; - } - return ret; -} - -void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem, - float* fWidth, - float* fHeight) { - CXFA_Node* pNode = pLayoutItem->m_pFormNode; - switch (pNode->GetElementType()) { - case XFA_Element::Subform: - case XFA_Element::Area: - case XFA_Element::ExclGroup: - case XFA_Element::SubformSet: { - if (*fWidth < -XFA_LAYOUT_FLOAT_PERCISION) - *fWidth = pLayoutItem->m_sSize.width; - if (*fHeight < -XFA_LAYOUT_FLOAT_PERCISION) - *fHeight = pLayoutItem->m_sSize.height; - break; - } - case XFA_Element::Draw: - case XFA_Element::Field: { - pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, *fWidth, - *fHeight); - break; - } - default: - ASSERT(false); - } -} - -CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, - bool* bContainerWidthAutoSize, - bool* bContainerHeightAutoSize) { - *bContainerWidthAutoSize = true; - *bContainerHeightAutoSize = true; - - XFA_Element eType = pFormNode->GetElementType(); - CXFA_Measurement mTmpValue; - CFX_SizeF containerSize; - if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && - pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) && - mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); - *bContainerWidthAutoSize = false; - } - if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && - pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) && - mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); - *bContainerHeightAutoSize = false; - } - if (*bContainerWidthAutoSize && eType == XFA_Element::Subform && - pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) && - mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); - *bContainerWidthAutoSize = false; - } - if (*bContainerHeightAutoSize && eType == XFA_Element::Subform && - pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) && - mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); - *bContainerHeightAutoSize = false; - } - return containerSize; -} - -CFX_SizeF CalculateContainerComponentSizeFromContentSize( - CXFA_Node* pFormNode, - bool bContainerWidthAutoSize, - float fContentCalculatedWidth, - bool bContainerHeightAutoSize, - float fContentCalculatedHeight, - const CFX_SizeF& currentContainerSize) { - CFX_SizeF componentSize = currentContainerSize; - CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); - CXFA_Measurement mTmpValue; - if (bContainerWidthAutoSize) { - componentSize.width = fContentCalculatedWidth; - if (pMarginNode) { - if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false)) - componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); - if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false)) - componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); - } - } - - if (bContainerHeightAutoSize) { - componentSize.height = fContentCalculatedHeight; - if (pMarginNode) { - if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false)) - componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); - if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue, - false)) { - componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); - } - } - } - return componentSize; -} - -void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, - const std::vector& rgSpecifiedColumnWidths, - XFA_ATTRIBUTEENUM eLayout) { - bool bContainerWidthAutoSize = true; - bool bContainerHeightAutoSize = true; - CFX_SizeF containerSize = CalculateContainerSpecifiedSize( - pLayoutRow->m_pFormNode, &bContainerWidthAutoSize, - &bContainerHeightAutoSize); - CXFA_Node* pMarginNode = - pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - float fLeftInset = 0; - float fTopInset = 0; - float fRightInset = 0; - float fBottomInset = 0; - if (pMarginNode) { - fLeftInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fTopInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); - fRightInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - fBottomInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); - } - - float fContentWidthLimit = - bContainerWidthAutoSize ? FLT_MAX - : containerSize.width - fLeftInset - fRightInset; - float fContentCurrentHeight = - pLayoutRow->m_sSize.height - fTopInset - fBottomInset; - float fContentCalculatedWidth = 0; - float fContentCalculatedHeight = 0; - float fCurrentColX = 0; - int32_t nCurrentColIdx = 0; - bool bMetWholeRowCell = false; - - for (auto* pLayoutChild = - static_cast(pLayoutRow->m_pFirstChild); - pLayoutChild; pLayoutChild = static_cast( - pLayoutChild->m_pNextSibling)) { - int32_t nOriginalColSpan = - pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); - int32_t nColSpan = nOriginalColSpan; - float fColSpanWidth = 0; - if (nColSpan == -1 || - nCurrentColIdx + nColSpan > - pdfium::CollectionSize(rgSpecifiedColumnWidths)) { - nColSpan = pdfium::CollectionSize(rgSpecifiedColumnWidths) - - nCurrentColIdx; - } - for (int32_t i = 0; i < nColSpan; i++) - fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i]; - - if (nColSpan != nOriginalColSpan) { - fColSpanWidth = - bMetWholeRowCell ? 0 : std::max(fColSpanWidth, - pLayoutChild->m_sSize.height); - } - if (nOriginalColSpan == -1) - bMetWholeRowCell = true; - - pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0); - pLayoutChild->m_sSize.width = fColSpanWidth; - if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) - continue; - - fCurrentColX += fColSpanWidth; - nCurrentColIdx += nColSpan; - float fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight; - UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight); - pLayoutChild->m_sSize.height = fNewHeight; - if (bContainerHeightAutoSize) { - fContentCalculatedHeight = - std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height); - } - } - - if (bContainerHeightAutoSize) { - for (CXFA_ContentLayoutItem* pLayoutChild = - (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; - pLayoutChild; - pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { - UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width, - &fContentCalculatedHeight); - float fOldChildHeight = pLayoutChild->m_sSize.height; - pLayoutChild->m_sSize.height = fContentCalculatedHeight; - CXFA_Node* pParaNode = - pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para); - if (pParaNode && pLayoutChild->m_pFirstChild) { - float fOffHeight = fContentCalculatedHeight - fOldChildHeight; - XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign); - switch (eVType) { - case XFA_ATTRIBUTEENUM_Middle: - fOffHeight = fOffHeight / 2; - break; - case XFA_ATTRIBUTEENUM_Bottom: - break; - case XFA_ATTRIBUTEENUM_Top: - default: - fOffHeight = 0; - break; - } - if (fOffHeight > 0) { - for (CXFA_ContentLayoutItem* pInnerLayoutChild = - (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild; - pInnerLayoutChild; - pInnerLayoutChild = - (CXFA_ContentLayoutItem*)pInnerLayoutChild->m_pNextSibling) { - pInnerLayoutChild->m_sPos.y += fOffHeight; - } - } - } - } - } - - if (bContainerWidthAutoSize) { - float fChildSuppliedWidth = fCurrentColX; - if (fContentWidthLimit < FLT_MAX && - fContentWidthLimit > fChildSuppliedWidth) { - fChildSuppliedWidth = fContentWidthLimit; - } - fContentCalculatedWidth = - std::max(fContentCalculatedWidth, fChildSuppliedWidth); - } else { - fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset; - } - - if (pLayoutRow->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) == - XFA_ATTRIBUTEENUM_Rl_row) { - for (CXFA_ContentLayoutItem* pLayoutChild = - (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; - pLayoutChild; - pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { - pLayoutChild->m_sPos.x = fContentCalculatedWidth - - pLayoutChild->m_sPos.x - - pLayoutChild->m_sSize.width; - } - } - pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize( - pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, - bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); -} - -void UpdatePendingItemLayout(CXFA_ItemLayoutProcessor* pProcessor, - CXFA_ContentLayoutItem* pLayoutItem) { - XFA_ATTRIBUTEENUM eLayout = - pLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - switch (eLayout) { - case XFA_ATTRIBUTEENUM_Row: - case XFA_ATTRIBUTEENUM_Rl_row: - RelocateTableRowCells(pLayoutItem, pProcessor->m_rgSpecifiedColumnWidths, - eLayout); - break; - default: - break; - } -} - -void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, - float fSplitPos, - CXFA_ContentLayoutItem* pTrailerLayoutItem, - bool bUseInherited) { - if (!pTrailerLayoutItem) - return; - - float fHeight = pTrailerLayoutItem->m_sSize.height; - if (bUseInherited) { - float fNewSplitPos = 0; - if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) - fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); - if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) - pProcessor->SplitLayoutItem(fNewSplitPos); - return; - } - - UpdatePendingItemLayout(pProcessor, pTrailerLayoutItem); - CXFA_Node* pMarginNode = - pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - float fLeftInset = 0; - float fTopInset = 0; - float fRightInset = 0; - float fBottomInset = 0; - if (pMarginNode) { - fLeftInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fTopInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); - fRightInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - fBottomInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); - } - - if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) { - pTrailerLayoutItem->m_sPos.y = pProcessor->m_fLastRowY; - pTrailerLayoutItem->m_sPos.x = pProcessor->m_fLastRowWidth; - pProcessor->m_pLayoutItem->m_sSize.width += - pTrailerLayoutItem->m_sSize.width; - pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); - return; - } - - float fNewSplitPos = 0; - if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) - fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); - - if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { - pProcessor->SplitLayoutItem(fNewSplitPos); - pTrailerLayoutItem->m_sPos.y = fNewSplitPos - fTopInset - fBottomInset; - } else { - pTrailerLayoutItem->m_sPos.y = fSplitPos - fTopInset - fBottomInset; - } - - switch (pTrailerLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { - case XFA_ATTRIBUTEENUM_Right: - pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - - fRightInset - - pTrailerLayoutItem->m_sSize.width; - break; - case XFA_ATTRIBUTEENUM_Center: - pTrailerLayoutItem->m_sPos.x = - (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - - pTrailerLayoutItem->m_sSize.width) / - 2; - break; - case XFA_ATTRIBUTEENUM_Left: - default: - pTrailerLayoutItem->m_sPos.x = fLeftInset; - break; - } - pProcessor->m_pLayoutItem->m_sSize.height += fHeight; - pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); -} - -void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, - CXFA_ContentLayoutItem* pLeaderLayoutItem) { - UpdatePendingItemLayout(pProcessor, pLeaderLayoutItem); - - CXFA_Node* pMarginNode = - pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - float fLeftInset = 0; - float fRightInset = 0; - if (pMarginNode) { - fLeftInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fRightInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - } - - float fHeight = pLeaderLayoutItem->m_sSize.height; - for (CXFA_ContentLayoutItem* pChildItem = - (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild; - pChildItem; - pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { - pChildItem->m_sPos.y += fHeight; - } - pLeaderLayoutItem->m_sPos.y = 0; - - switch (pLeaderLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { - case XFA_ATTRIBUTEENUM_Right: - pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - - fRightInset - - pLeaderLayoutItem->m_sSize.width; - break; - case XFA_ATTRIBUTEENUM_Center: - pLeaderLayoutItem->m_sPos.x = - (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - - pLeaderLayoutItem->m_sSize.width) / - 2; - break; - case XFA_ATTRIBUTEENUM_Left: - default: - pLeaderLayoutItem->m_sPos.x = fLeftInset; - break; - } - pProcessor->m_pLayoutItem->m_sSize.height += fHeight; - pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); -} - -void AddPendingNode(CXFA_ItemLayoutProcessor* pProcessor, - CXFA_Node* pPendingNode, - bool bBreakPending) { - pProcessor->m_PendingNodes.push_back(pPendingNode); - pProcessor->m_bBreakPending = bBreakPending; -} - -float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, - CXFA_Node* pCurChildNode) { - float fTotalHeight = 0; - if (pProcessor->m_PendingNodes.empty()) - return fTotalHeight; - - if (!pProcessor->m_pLayoutItem) { - pProcessor->m_pLayoutItem = - pProcessor->CreateContentLayoutItem(pCurChildNode); - pProcessor->m_pLayoutItem->m_sSize.clear(); - } - - while (!pProcessor->m_PendingNodes.empty()) { - auto pPendingProcessor = pdfium::MakeUnique( - pProcessor->m_PendingNodes.front(), nullptr); - pProcessor->m_PendingNodes.pop_front(); - pPendingProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr); - CXFA_ContentLayoutItem* pPendingLayoutItem = - pPendingProcessor->HasLayoutItem() - ? pPendingProcessor->ExtractLayoutItem() - : nullptr; - if (pPendingLayoutItem) { - AddLeaderAfterSplit(pProcessor, pPendingLayoutItem); - if (pProcessor->m_bBreakPending) - fTotalHeight += pPendingLayoutItem->m_sSize.height; - } - } - return fTotalHeight; -} - -XFA_ATTRIBUTEENUM GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) { - *bRootForceTb = false; - XFA_ATTRIBUTEENUM eLayoutMode; - if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, false)) - return eLayoutMode; - - CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); - if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) { - *bRootForceTb = true; - return XFA_ATTRIBUTEENUM_Tb; - } - return XFA_ATTRIBUTEENUM_Position; -} - -bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) { - if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) - return false; - - XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; - if (!bPreFind) - eItemType = XFA_NODEITEM_NextSibling; - - CXFA_Node* pPreContainer = - pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); - if (!pPreContainer) - return false; - - CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep); - if (pKeep) { - XFA_ATTRIBUTEENUM ePrevious; - XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; - if (!bPreFind) - eKeepType = XFA_ATTRIBUTE_Next; - - if (pKeep->TryEnum(eKeepType, ePrevious, false)) { - if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || - ePrevious == XFA_ATTRIBUTEENUM_PageArea) { - return true; - } - } - } - - pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep); - if (!pKeep) - return false; - - XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next; - if (!bPreFind) - eKeepType = XFA_ATTRIBUTE_Previous; - - XFA_ATTRIBUTEENUM eNext; - if (!pKeep->TryEnum(eKeepType, eNext, false)) - return false; - if (eNext == XFA_ATTRIBUTEENUM_ContentArea || - eNext == XFA_ATTRIBUTEENUM_PageArea) { - return true; - } - return false; -} - -bool FindBreakNode(CXFA_Node* pContainerNode, - CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages* nCurStage, - bool bBreakBefore) { - bool bFindRs = false; - for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; - pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; - if (!bBreakBefore) - eAttributeType = XFA_ATTRIBUTE_After; - - switch (pBreakNode->GetElementType()) { - case XFA_Element::BreakBefore: { - if (bBreakBefore) { - pCurActionNode = pBreakNode; - *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore; - bFindRs = true; - } - break; - } - case XFA_Element::BreakAfter: { - if (!bBreakBefore) { - pCurActionNode = pBreakNode; - *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter; - bFindRs = true; - } - break; - } - case XFA_Element::Break: - if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) { - pCurActionNode = pBreakNode; - *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore; - if (!bBreakBefore) - *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter; - - bFindRs = true; - } - break; - default: - break; - } - if (bFindRs) - break; - } - return bFindRs; -} - -void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { - CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify(); - CXFA_LayoutProcessor* pDocLayout = - pGenerateNode->GetDocument()->GetDocLayout(); - CXFA_NodeIteratorTemplate sIterator( - pGenerateNode); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - CXFA_ContentLayoutItem* pCurLayoutItem = - (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); - CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; - while (pCurLayoutItem) { - pNextLayoutItem = pCurLayoutItem->m_pNext; - pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); - delete pCurLayoutItem; - pCurLayoutItem = pNextLayoutItem; - } - } - pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); -} - -uint8_t HAlignEnumToInt(XFA_ATTRIBUTEENUM eHAlign) { - switch (eHAlign) { - case XFA_ATTRIBUTEENUM_Center: - return 1; - case XFA_ATTRIBUTEENUM_Right: - return 2; - case XFA_ATTRIBUTEENUM_Left: - default: - return 0; - } -} - -XFA_ItemLayoutProcessorResult InsertFlowedItem( - CXFA_ItemLayoutProcessor* pThis, - CXFA_ItemLayoutProcessor* pProcessor, - bool bContainerWidthAutoSize, - bool bContainerHeightAutoSize, - float fContainerHeight, - XFA_ATTRIBUTEENUM eFlowStrategy, - uint8_t* uCurHAlignState, - std::vector (&rgCurLineLayoutItems)[3], - bool bUseBreakControl, - float fAvailHeight, - float fRealHeight, - float fContentWidthLimit, - float* fContentCurRowY, - float* fContentCurRowAvailWidth, - float* fContentCurRowHeight, - bool* bAddedItemInRow, - bool* bForceEndPage, - CXFA_LayoutContext* pLayoutContext, - bool bNewRow) { - bool bTakeSpace = - XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); - uint8_t uHAlign = - HAlignEnumToInt(pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign)); - if (bContainerWidthAutoSize) - uHAlign = 0; - - if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb && - uHAlign < *uCurHAlignState) || - (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb && - uHAlign > *uCurHAlignState)) { - return XFA_ItemLayoutProcessorResult::RowFullBreak; - } - - *uCurHAlignState = uHAlign; - bool bIsOwnSplit = - pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None; - bool bUseRealHeight = - bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit && - pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() == - XFA_ATTRIBUTEENUM_None; - bool bIsTransHeight = bTakeSpace; - if (bIsTransHeight && !bIsOwnSplit) { - bool bRootForceTb = false; - XFA_ATTRIBUTEENUM eLayoutStrategy = - GetLayout(pProcessor->m_pFormNode, &bRootForceTb); - if (eLayoutStrategy == XFA_ATTRIBUTEENUM_Lr_tb || - eLayoutStrategy == XFA_ATTRIBUTEENUM_Rl_tb) { - bIsTransHeight = false; - } - } - - bool bUseInherited = false; - CXFA_LayoutContext layoutContext; - if (pThis->m_pPageMgr) { - CXFA_Node* pOverflowNode = - pThis->m_pPageMgr->QueryOverflow(pThis->m_pFormNode); - if (pOverflowNode) { - layoutContext.m_pOverflowNode = pOverflowNode; - layoutContext.m_pOverflowProcessor = pThis; - pLayoutContext = &layoutContext; - } - } - - XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult::Done; - if (!bNewRow || - pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult::Done) { - eRetValue = pProcessor->DoLayout( - bTakeSpace ? bUseBreakControl : false, - bUseRealHeight ? fRealHeight - *fContentCurRowY : FLT_MAX, - bIsTransHeight ? fRealHeight - *fContentCurRowY : FLT_MAX, - pLayoutContext); - pProcessor->m_ePreProcessRs = eRetValue; - } else { - eRetValue = pProcessor->m_ePreProcessRs; - pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult::Done; - } - if (pProcessor->HasLayoutItem() == false) - return eRetValue; - - CFX_SizeF childSize = pProcessor->GetCurrentComponentSize(); - if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) { - fRealHeight = FLT_MAX; - fAvailHeight = FLT_MAX; - } - if (bTakeSpace && (childSize.width > - *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) && - (fContentWidthLimit - *fContentCurRowAvailWidth > - XFA_LAYOUT_FLOAT_PERCISION)) { - return XFA_ItemLayoutProcessorResult::RowFullBreak; - } - - CXFA_Node* pOverflowLeaderNode = nullptr; - CXFA_Node* pOverflowTrailerNode = nullptr; - CXFA_Node* pFormNode = nullptr; - CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr; - bool bIsAddTrailerHeight = false; - if (pThis->m_pPageMgr && - pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { - pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); - if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) { - pFormNode = pLayoutContext->m_pOverflowNode; - bUseInherited = true; - } - if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, - pOverflowTrailerNode, false, - false)) { - if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { - if (pOverflowTrailerNode) { - auto pOverflowLeaderProcessor = - pdfium::MakeUnique(pOverflowTrailerNode, - nullptr); - pOverflowLeaderProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr); - pTrailerLayoutItem = - pOverflowLeaderProcessor->HasLayoutItem() - ? pOverflowLeaderProcessor->ExtractLayoutItem() - : nullptr; - } - - bIsAddTrailerHeight = - bUseInherited - ? pThis->IsAddNewRowForTrailer(pTrailerLayoutItem) - : pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); - if (bIsAddTrailerHeight) { - childSize.height += pTrailerLayoutItem->m_sSize.height; - bIsAddTrailerHeight = true; - } - } - } - } - - if (!bTakeSpace || - *fContentCurRowY + childSize.height <= - fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION || - (!bContainerHeightAutoSize && - pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >= - fContainerHeight)) { - if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) { - if (pProcessor->m_bUseInheriated) { - if (pTrailerLayoutItem) - AddTrailerBeforeSplit(pProcessor, childSize.height, - pTrailerLayoutItem, false); - if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) - AddPendingNode(pProcessor, pOverflowLeaderNode, false); - - pProcessor->m_bUseInheriated = false; - } else { - if (bIsAddTrailerHeight) - childSize.height -= pTrailerLayoutItem->m_sSize.height; - - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, - pOverflowTrailerNode, - pTrailerLayoutItem, pFormNode); - } - - CXFA_ContentLayoutItem* pChildLayoutItem = - pProcessor->ExtractLayoutItem(); - if (ExistContainerKeep(pProcessor->m_pFormNode, false) && - pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { - pThis->m_arrayKeepItems.push_back(pChildLayoutItem); - } else { - pThis->m_arrayKeepItems.clear(); - } - rgCurLineLayoutItems[uHAlign].push_back(pChildLayoutItem); - *bAddedItemInRow = true; - if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.width; - *fContentCurRowHeight = - std::max(*fContentCurRowHeight, childSize.height); - } - return XFA_ItemLayoutProcessorResult::Done; - } - - if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) { - if (pProcessor->m_bUseInheriated) { - if (pTrailerLayoutItem) { - AddTrailerBeforeSplit(pProcessor, childSize.height, - pTrailerLayoutItem, false); - } - if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) - AddPendingNode(pProcessor, pOverflowLeaderNode, false); - - pProcessor->m_bUseInheriated = false; - } else { - if (bIsAddTrailerHeight) - childSize.height -= pTrailerLayoutItem->m_sSize.height; - - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, - pOverflowTrailerNode, - pTrailerLayoutItem, pFormNode); - } - } - rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); - *bAddedItemInRow = true; - *fContentCurRowAvailWidth -= childSize.width; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); - return eRetValue; - } - - XFA_ItemLayoutProcessorResult eResult; - if (pThis->ProcessKeepForSplit( - pThis, pProcessor, eRetValue, &rgCurLineLayoutItems[uHAlign], - fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY, - bAddedItemInRow, bForceEndPage, &eResult)) { - return eResult; - } - - *bForceEndPage = true; - float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY); - if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { - XFA_ATTRIBUTEENUM eLayout = - pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - if (eLayout == XFA_ATTRIBUTEENUM_Tb && - eRetValue == XFA_ItemLayoutProcessorResult::Done) { - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, - pOverflowTrailerNode, pTrailerLayoutItem, - pFormNode); - rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); - *bAddedItemInRow = true; - if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.width; - *fContentCurRowHeight = - std::max(*fContentCurRowHeight, childSize.height); - } - return XFA_ItemLayoutProcessorResult::PageFullBreak; - } - - CXFA_Node* pTempLeaderNode = nullptr; - CXFA_Node* pTempTrailerNode = nullptr; - if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && - eRetValue != XFA_ItemLayoutProcessorResult::PageFullBreak) { - pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, - pTempTrailerNode, false, true); - } - if (pTrailerLayoutItem && bIsAddTrailerHeight) { - AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem, - bUseInherited); - } else { - pProcessor->SplitLayoutItem(fSplitPos); - } - - if (bUseInherited) { - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, - pOverflowTrailerNode, pTrailerLayoutItem, - pFormNode); - pThis->m_bUseInheriated = true; - } else { - CXFA_LayoutItem* firstChild = pProcessor->m_pLayoutItem->m_pFirstChild; - if (firstChild && !firstChild->m_pNextSibling && - firstChild->m_pFormNode->IsLayoutGeneratedNode()) { - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, - pOverflowTrailerNode, - pTrailerLayoutItem, pFormNode); - } else if (pProcessor->JudgeLeaderOrTrailerForOccur( - pOverflowLeaderNode)) { - AddPendingNode(pProcessor, pOverflowLeaderNode, false); - } - } - - if (pProcessor->m_pLayoutItem->m_pNextSibling) { - childSize = pProcessor->GetCurrentComponentSize(); - rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); - *bAddedItemInRow = true; - if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.width; - *fContentCurRowHeight = - std::max(*fContentCurRowHeight, childSize.height); - } - } - return XFA_ItemLayoutProcessorResult::PageFullBreak; - } - - if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { - childSize = pProcessor->GetCurrentComponentSize(); - if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) { - CXFA_Node* pTempLeaderNode = nullptr; - CXFA_Node* pTempTrailerNode = nullptr; - if (pThis->m_pPageMgr) { - if (!pFormNode && pLayoutContext) - pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; - - pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, - pTempTrailerNode, false, true); - } - if (bUseInherited) { - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, - pOverflowTrailerNode, - pTrailerLayoutItem, pFormNode); - pThis->m_bUseInheriated = true; - } - return XFA_ItemLayoutProcessorResult::PageFullBreak; - } - - rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); - *bAddedItemInRow = true; - if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.width; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); - } - if (eRetValue == XFA_ItemLayoutProcessorResult::Done) - *bForceEndPage = false; - - return eRetValue; - } - - XFA_ATTRIBUTEENUM eLayout = - pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - if (pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None && - eLayout == XFA_ATTRIBUTEENUM_Tb) { - if (pThis->m_pPageMgr) { - pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, - pOverflowTrailerNode, false, true); - } - if (pTrailerLayoutItem) - AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem, false); - if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) - AddPendingNode(pProcessor, pOverflowLeaderNode, false); - - return XFA_ItemLayoutProcessorResult::PageFullBreak; - } - - if (eRetValue != XFA_ItemLayoutProcessorResult::Done) - return XFA_ItemLayoutProcessorResult::PageFullBreak; - - if (!pFormNode && pLayoutContext) - pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; - if (pThis->m_pPageMgr) { - pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, - pOverflowTrailerNode, false, true); - } - if (bUseInherited) { - pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, - pTrailerLayoutItem, pFormNode); - pThis->m_bUseInheriated = true; - } - return XFA_ItemLayoutProcessorResult::PageFullBreak; -} - -bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, - float fCurVerticalOffset, - float* fProposedSplitPos, - bool* bAppChange, - bool bCalculateMargin) { - CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; - if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION || - *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height - - XFA_LAYOUT_FLOAT_PERCISION) { - return false; - } - - switch (pFormNode->GetIntact()) { - case XFA_ATTRIBUTEENUM_None: { - bool bAnyChanged = false; - CXFA_Document* pDocument = pFormNode->GetDocument(); - CXFA_FFNotify* pNotify = pDocument->GetNotify(); - float fCurTopMargin = 0, fCurBottomMargin = 0; - CXFA_Node* pMarginNode = - pFormNode->GetFirstChildByClass(XFA_Element::Margin); - if (pMarginNode && bCalculateMargin) { - fCurTopMargin = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); - fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) - .ToUnit(XFA_UNIT_Pt); - } - bool bChanged = true; - while (bChanged) { - bChanged = false; - { - float fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset; - if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(), - fRelSplitPos)) { - bAnyChanged = true; - bChanged = true; - *fProposedSplitPos = fCurVerticalOffset + fRelSplitPos; - *bAppChange = true; - if (*fProposedSplitPos <= - fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { - return true; - } - } - } - float fRelSplitPos = *fProposedSplitPos - fCurBottomMargin; - for (CXFA_ContentLayoutItem* pChildItem = - (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; - pChildItem; - pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { - float fChildOffset = - fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; - bool bChange = false; - if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos, - &bChange, bCalculateMargin)) { - if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && - bChange) { - *fProposedSplitPos = fRelSplitPos - fCurTopMargin; - } else { - *fProposedSplitPos = fRelSplitPos + fCurBottomMargin; - } - bAnyChanged = true; - bChanged = true; - if (*fProposedSplitPos <= - fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { - return true; - } - if (bAnyChanged) - break; - } - } - } - return bAnyChanged; - } - case XFA_ATTRIBUTEENUM_ContentArea: - case XFA_ATTRIBUTEENUM_PageArea: { - *fProposedSplitPos = fCurVerticalOffset; - return true; - } - default: - return false; - } -} - -CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode, - const CFX_SizeF& size) { - XFA_ATTRIBUTEENUM eAnchorType = pNode->GetEnum(XFA_ATTRIBUTE_AnchorType); - int32_t nAnchorType = 0; - switch (eAnchorType) { - case XFA_ATTRIBUTEENUM_TopLeft: - nAnchorType = 0; - break; - case XFA_ATTRIBUTEENUM_TopCenter: - nAnchorType = 1; - break; - case XFA_ATTRIBUTEENUM_TopRight: - nAnchorType = 2; - break; - case XFA_ATTRIBUTEENUM_MiddleLeft: - nAnchorType = 3; - break; - case XFA_ATTRIBUTEENUM_MiddleCenter: - nAnchorType = 4; - break; - case XFA_ATTRIBUTEENUM_MiddleRight: - nAnchorType = 5; - break; - case XFA_ATTRIBUTEENUM_BottomLeft: - nAnchorType = 6; - break; - case XFA_ATTRIBUTEENUM_BottomCenter: - nAnchorType = 7; - break; - case XFA_ATTRIBUTEENUM_BottomRight: - nAnchorType = 8; - break; - default: - break; - } - static const uint8_t nNextPos[4][9] = {{0, 1, 2, 3, 4, 5, 6, 7, 8}, - {6, 3, 0, 7, 4, 1, 8, 5, 2}, - {8, 7, 6, 5, 4, 3, 2, 1, 0}, - {2, 5, 8, 1, 4, 7, 0, 3, 6}}; - - CFX_PointF pos(pNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt), - pNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt)); - int32_t nRotate = - FXSYS_round(pNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); - nRotate = XFA_MapRotation(nRotate) / 90; - int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType]; - switch (nAbsoluteAnchorType / 3) { - case 1: - pos.y -= size.height / 2; - break; - case 2: - pos.y -= size.height; - break; - default: - break; - } - switch (nAbsoluteAnchorType % 3) { - case 1: - pos.x -= size.width / 2; - break; - case 2: - pos.x -= size.width; - break; - default: - break; - } - return pos; -} - -} // namespace - -CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, - CXFA_LayoutPageMgr* pPageMgr) - : m_pFormNode(pNode), - m_pLayoutItem(nullptr), - m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), - m_fUsedSize(0), - m_pPageMgr(pPageMgr), - m_bBreakPending(true), - m_fLastRowWidth(0), - m_fLastRowY(0), - m_bUseInheriated(false), - m_ePreProcessRs(XFA_ItemLayoutProcessorResult::Done), - m_bKeepBreakFinish(false), - m_bIsProcessKeep(false), - m_pKeepHeadNode(nullptr), - m_pKeepTailNode(nullptr), - m_pOldLayoutItem(nullptr), - m_pCurChildPreprocessor(nullptr), - m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages::None), - m_fWidthLimite(0), - m_bHasAvailHeight(true) { - ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || - m_pFormNode->GetElementType() == XFA_Element::Form)); - m_pOldLayoutItem = - (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); -} - -CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} - -CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( - CXFA_Node* pFormNode) { - if (!pFormNode) - return nullptr; - - CXFA_ContentLayoutItem* pLayoutItem = nullptr; - if (m_pOldLayoutItem) { - pLayoutItem = m_pOldLayoutItem; - m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; - return pLayoutItem; - } - pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument() - ->GetNotify() - ->OnCreateLayoutItem(pFormNode); - CXFA_ContentLayoutItem* pPrevLayoutItem = - (CXFA_ContentLayoutItem*)pFormNode->GetUserData(XFA_LAYOUTITEMKEY); - if (pPrevLayoutItem) { - while (pPrevLayoutItem->m_pNext) - pPrevLayoutItem = pPrevLayoutItem->m_pNext; - - pPrevLayoutItem->m_pNext = pLayoutItem; - pLayoutItem->m_pPrev = pPrevLayoutItem; - } else { - pFormNode->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem); - } - return pLayoutItem; -} - -float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) { - ASSERT(m_pLayoutItem); - XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - bool bCalculateMargin = eLayout != XFA_ATTRIBUTEENUM_Position; - while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { - bool bAppChange = false; - if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, &fProposedSplitPos, - &bAppChange, bCalculateMargin)) { - break; - } - } - return fProposedSplitPos; -} - -void CXFA_ItemLayoutProcessor::SplitLayoutItem( - CXFA_ContentLayoutItem* pLayoutItem, - CXFA_ContentLayoutItem* pSecondParent, - float fSplitPos) { - float fCurTopMargin = 0, fCurBottomMargin = 0; - XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - bool bCalculateMargin = true; - if (eLayout == XFA_ATTRIBUTEENUM_Position) - bCalculateMargin = false; - - CXFA_Node* pMarginNode = - pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - if (pMarginNode && bCalculateMargin) { - fCurTopMargin = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); - fCurBottomMargin = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); - } - - CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr; - if (m_pCurChildPreprocessor && - m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) { - pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem( - pLayoutItem->m_pFormNode); - } else { - pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode); - } - pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x; - pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width; - pSecondLayoutItem->m_sPos.y = 0; - pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos; - pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height; - if (pLayoutItem->m_pFirstChild) - pSecondLayoutItem->m_sSize.height += fCurTopMargin; - - if (pSecondParent) { - pSecondParent->AddChild(pSecondLayoutItem); - if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) { - pSecondParent->m_sSize.height += fCurTopMargin; - CXFA_ContentLayoutItem* pParentItem = - (CXFA_ContentLayoutItem*)pSecondParent->m_pParent; - while (pParentItem) { - pParentItem->m_sSize.height += fCurTopMargin; - pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; - } - } - } else { - pSecondLayoutItem->m_pParent = pLayoutItem->m_pParent; - pSecondLayoutItem->m_pNextSibling = pLayoutItem->m_pNextSibling; - pLayoutItem->m_pNextSibling = pSecondLayoutItem; - } - - CXFA_ContentLayoutItem* pChildren = - (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; - pLayoutItem->m_pFirstChild = nullptr; - - float lHeightForKeep = 0; - float fAddMarginHeight = 0; - std::vector keepLayoutItems; - for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; - pChildItem; pChildItem = pChildNext) { - pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; - pChildItem->m_pNextSibling = nullptr; - if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + - XFA_LAYOUT_FLOAT_PERCISION) { - if (!ExistContainerKeep(pChildItem->m_pFormNode, true)) { - pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin; - pChildItem->m_sPos.y += lHeightForKeep; - pChildItem->m_sPos.y += fAddMarginHeight; - pSecondLayoutItem->AddChild(pChildItem); - continue; - } - if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) { - for (auto* pPreItem : keepLayoutItems) { - pLayoutItem->RemoveChild(pPreItem); - pPreItem->m_sPos.y -= fSplitPos; - if (pPreItem->m_sPos.y < 0) - pPreItem->m_sPos.y = 0; - if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) { - pPreItem->m_sPos.y = lHeightForKeep; - lHeightForKeep += pPreItem->m_sSize.height; - pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height; - if (pSecondParent) - pSecondParent->m_sSize.height += pPreItem->m_sSize.height; - } - pSecondLayoutItem->AddChild(pPreItem); - } - } - pChildItem->m_sPos.y -= fSplitPos; - pChildItem->m_sPos.y += lHeightForKeep; - pChildItem->m_sPos.y += fAddMarginHeight; - pSecondLayoutItem->AddChild(pChildItem); - continue; - } - if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >= - fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y + - pChildItem->m_sSize.height) { - pLayoutItem->AddChild(pChildItem); - if (ExistContainerKeep(pChildItem->m_pFormNode, false)) - keepLayoutItems.push_back(pChildItem); - else - keepLayoutItems.clear(); - continue; - } - - float fOldHeight = pSecondLayoutItem->m_sSize.height; - SplitLayoutItem( - pChildItem, pSecondLayoutItem, - fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); - fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight; - pLayoutItem->AddChild(pChildItem); - } -} - -void CXFA_ItemLayoutProcessor::SplitLayoutItem(float fSplitPos) { - ASSERT(m_pLayoutItem); - SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos); -} - -CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { - CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem; - if (pLayoutItem) { - m_pLayoutItem = - static_cast(pLayoutItem->m_pNextSibling); - pLayoutItem->m_pNextSibling = nullptr; - } - - if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done || - !ToContentLayoutItem(m_pOldLayoutItem)) { - return pLayoutItem; - } - - if (m_pOldLayoutItem->m_pPrev) - m_pOldLayoutItem->m_pPrev->m_pNext = nullptr; - - CXFA_FFNotify* pNotify = - m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify(); - CXFA_LayoutProcessor* pDocLayout = - m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); - CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; - while (pOldLayoutItem) { - CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext; - pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem); - if (pOldLayoutItem->m_pParent) - pOldLayoutItem->m_pParent->RemoveChild(pOldLayoutItem); - - delete pOldLayoutItem; - pOldLayoutItem = pNextOldLayoutItem; - } - m_pOldLayoutItem = nullptr; - return pLayoutItem; -} - -void CXFA_ItemLayoutProcessor::GotoNextContainerNode( - CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages& nCurStage, - CXFA_Node* pParentContainer, - bool bUsePageBreak) { - CXFA_Node* pEntireContainer = pParentContainer; - CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE; - switch (nCurStage) { - case XFA_ItemLayoutProcessorStages::BreakBefore: - case XFA_ItemLayoutProcessorStages::BreakAfter: { - pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent); - break; - } - case XFA_ItemLayoutProcessorStages::Keep: - case XFA_ItemLayoutProcessorStages::Container: - pChildContainer = pCurActionNode; - break; - default: - pChildContainer = XFA_LAYOUT_INVALIDNODE; - break; - } - - switch (nCurStage) { - case XFA_ItemLayoutProcessorStages::Keep: { - CXFA_Node* pBreakAfterNode = - pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); - if (!m_bKeepBreakFinish && - FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false)) { - return; - } - goto CheckNextChildContainer; - } - case XFA_ItemLayoutProcessorStages::None: { - pCurActionNode = XFA_LAYOUT_INVALIDNODE; - case XFA_ItemLayoutProcessorStages::BookendLeader: - for (CXFA_Node* pBookendNode = - pCurActionNode == XFA_LAYOUT_INVALIDNODE - ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) - : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); - pBookendNode; pBookendNode = pBookendNode->GetNodeItem( - XFA_NODEITEM_NextSibling)) { - switch (pBookendNode->GetElementType()) { - case XFA_Element::Bookend: - case XFA_Element::Break: - pCurActionNode = pBookendNode; - nCurStage = XFA_ItemLayoutProcessorStages::BookendLeader; - return; - default: - break; - } - } - } - { - pCurActionNode = XFA_LAYOUT_INVALIDNODE; - case XFA_ItemLayoutProcessorStages::BreakBefore: - if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) { - CXFA_Node* pBreakBeforeNode = - pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); - if (!m_bKeepBreakFinish && - FindBreakNode(pBreakBeforeNode, pCurActionNode, &nCurStage, - true)) { - return; - } - if (m_bIsProcessKeep) { - if (ProcessKeepNodesForBreakBefore(pCurActionNode, nCurStage, - pChildContainer)) { - return; - } - goto CheckNextChildContainer; - } - pCurActionNode = pChildContainer; - nCurStage = XFA_ItemLayoutProcessorStages::Container; - return; - } - goto CheckNextChildContainer; - } - case XFA_ItemLayoutProcessorStages::Container: { - pCurActionNode = XFA_LAYOUT_INVALIDNODE; - case XFA_ItemLayoutProcessorStages::BreakAfter: { - if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) { - CXFA_Node* pBreakAfterNode = - pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); - if (!m_bKeepBreakFinish && - FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, - false)) { - return; - } - } else { - CXFA_Node* pBreakAfterNode = - pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); - if (FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, - false)) { - return; - } - } - goto CheckNextChildContainer; - } - } - - CheckNextChildContainer : { - CXFA_Node* pNextChildContainer = - pChildContainer == XFA_LAYOUT_INVALIDNODE - ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild, - XFA_ObjectType::ContainerNode) - : pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, - XFA_ObjectType::ContainerNode); - while (pNextChildContainer && - pNextChildContainer->IsLayoutGeneratedNode()) { - CXFA_Node* pSaveNode = pNextChildContainer; - pNextChildContainer = pNextChildContainer->GetNodeItem( - XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode); - if (pSaveNode->IsUnusedNode()) - DeleteLayoutGeneratedNode(pSaveNode); - } - if (!pNextChildContainer) - goto NoMoreChildContainer; - - bool bLastKeep = false; - if (ProcessKeepNodesForCheckNext(pCurActionNode, nCurStage, - pNextChildContainer, bLastKeep)) { - return; - } - if (!m_bKeepBreakFinish && !bLastKeep && - FindBreakNode( - pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild), - pCurActionNode, &nCurStage, true)) { - return; - } - pCurActionNode = pNextChildContainer; - if (m_bIsProcessKeep) - nCurStage = XFA_ItemLayoutProcessorStages::Keep; - else - nCurStage = XFA_ItemLayoutProcessorStages::Container; - return; - } - - NoMoreChildContainer : { - pCurActionNode = XFA_LAYOUT_INVALIDNODE; - case XFA_ItemLayoutProcessorStages::BookendTrailer: - for (CXFA_Node* pBookendNode = - pCurActionNode == XFA_LAYOUT_INVALIDNODE - ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) - : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); - pBookendNode; pBookendNode = pBookendNode->GetNodeItem( - XFA_NODEITEM_NextSibling)) { - switch (pBookendNode->GetElementType()) { - case XFA_Element::Bookend: - case XFA_Element::Break: - pCurActionNode = pBookendNode; - nCurStage = XFA_ItemLayoutProcessorStages::BookendTrailer; - return; - default: - break; - } - } - } - default: - pCurActionNode = nullptr; - nCurStage = XFA_ItemLayoutProcessorStages::Done; - } -} - -bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( - CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages& nCurStage, - CXFA_Node*& pNextContainer, - bool& bLastKeepNode) { - const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; - bool bNextKeep = false; - if (ExistContainerKeep(pNextContainer, false)) - bNextKeep = true; - - if (bNextKeep && !bCanSplit) { - if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { - m_pKeepHeadNode = pNextContainer; - m_bIsProcessKeep = true; - } - return false; - } - - if (m_bIsProcessKeep && m_pKeepHeadNode) { - m_pKeepTailNode = pNextContainer; - if (!m_bKeepBreakFinish && - FindBreakNode(pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild), - pCurActionNode, &nCurStage, true)) { - return true; - } - - pNextContainer = m_pKeepHeadNode; - m_bKeepBreakFinish = true; - m_pKeepHeadNode = nullptr; - m_pKeepTailNode = nullptr; - m_bIsProcessKeep = false; - } else { - if (m_bKeepBreakFinish) - bLastKeepNode = true; - m_bKeepBreakFinish = false; - } - - return false; -} - -bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( - CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages& nCurStage, - CXFA_Node* pContainerNode) { - if (m_pKeepTailNode == pContainerNode) { - pCurActionNode = m_pKeepHeadNode; - m_bKeepBreakFinish = true; - m_pKeepHeadNode = nullptr; - m_pKeepTailNode = nullptr; - m_bIsProcessKeep = false; - nCurStage = XFA_ItemLayoutProcessorStages::Container; - return true; - } - - CXFA_Node* pBreakAfterNode = - pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild); - return FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false); -} - -bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) { - XFA_ATTRIBUTEENUM ePresence = pNode->GetEnum(XFA_ATTRIBUTE_Presence); - return ePresence == XFA_ATTRIBUTEENUM_Visible || - ePresence == XFA_ATTRIBUTEENUM_Invisible; -} - -bool CXFA_ItemLayoutProcessor::IncrementRelayoutNode( - CXFA_LayoutProcessor* pLayoutProcessor, - CXFA_Node* pNode, - CXFA_Node* pParentNode) { - return false; -} - -void CXFA_ItemLayoutProcessor::DoLayoutPageArea( - CXFA_ContainerLayoutItem* pPageAreaLayoutItem) { - CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode; - CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; - XFA_ItemLayoutProcessorStages nCurChildNodeStage = - XFA_ItemLayoutProcessorStages::None; - CXFA_LayoutItem* pBeforeItem = nullptr; - for (GotoNextContainerNode(pCurChildNode, nCurChildNodeStage, pFormNode, - false); - pCurChildNode; GotoNextContainerNode(pCurChildNode, nCurChildNodeStage, - pFormNode, false)) { - if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container) - continue; - if (pCurChildNode->GetElementType() == XFA_Element::Variables) - continue; - - auto pProcessor = - pdfium::MakeUnique(pCurChildNode, nullptr); - pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr); - if (!pProcessor->HasLayoutItem()) - continue; - - pProcessor->SetCurrentComponentPos(CalculatePositionedContainerPos( - pCurChildNode, pProcessor->GetCurrentComponentSize())); - CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem(); - if (!pBeforeItem) - pPageAreaLayoutItem->AddHeadChild(pProcessItem); - else - pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem); - - pBeforeItem = pProcessItem; - } - - pBeforeItem = nullptr; - CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild; - while (pLayoutItem) { - if (!pLayoutItem->IsContentLayoutItem() || - pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) { - pLayoutItem = pLayoutItem->m_pNextSibling; - continue; - } - if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) - continue; - - CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling; - pPageAreaLayoutItem->RemoveChild(pLayoutItem); - if (!pBeforeItem) - pPageAreaLayoutItem->AddHeadChild(pLayoutItem); - else - pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem); - - pBeforeItem = pLayoutItem; - pLayoutItem = pNextLayoutItem; - } -} - -void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( - CXFA_LayoutContext* pContext) { - if (m_pLayoutItem) - return; - - m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - bool bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) != - XFA_ATTRIBUTEENUM_Position); - bool bContainerWidthAutoSize = true; - bool bContainerHeightAutoSize = true; - CFX_SizeF containerSize = CalculateContainerSpecifiedSize( - m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); - - float fContentCalculatedWidth = 0; - float fContentCalculatedHeight = 0; - float fHiddenContentCalculatedWidth = 0; - float fHiddenContentCalculatedHeight = 0; - if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { - GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, - false); - } - - int32_t iColIndex = 0; - for (; m_pCurChildNode; GotoNextContainerNode( - m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) { - if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container) - continue; - if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) - continue; - - auto pProcessor = pdfium::MakeUnique( - m_pCurChildNode, m_pPageMgr); - if (pContext && pContext->m_prgSpecifiedColumnWidths) { - int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); - if (iColSpan <= pdfium::CollectionSize( - *pContext->m_prgSpecifiedColumnWidths) - - iColIndex) { - pContext->m_fCurColumnWidth = 0; - pContext->m_bCurColumnWidthAvaiable = true; - if (iColSpan == -1) { - iColSpan = pdfium::CollectionSize( - *pContext->m_prgSpecifiedColumnWidths); - } - for (int32_t i = 0; iColIndex + i < iColSpan; ++i) { - pContext->m_fCurColumnWidth += - (*pContext->m_prgSpecifiedColumnWidths)[iColIndex + i]; - } - if (pContext->m_fCurColumnWidth == 0) - pContext->m_bCurColumnWidthAvaiable = false; - - iColIndex += iColSpan >= 0 ? iColSpan : 0; - } - } - - pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pContext); - if (!pProcessor->HasLayoutItem()) - continue; - - CFX_SizeF size = pProcessor->GetCurrentComponentSize(); - bool bChangeParentSize = false; - if (XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) - bChangeParentSize = true; - - CFX_PointF absolutePos; - if (!bIgnoreXY) - absolutePos = CalculatePositionedContainerPos(m_pCurChildNode, size); - - pProcessor->SetCurrentComponentPos(absolutePos); - if (bContainerWidthAutoSize) { - float fChildSuppliedWidth = absolutePos.x + size.width; - if (bChangeParentSize) { - fContentCalculatedWidth = - std::max(fContentCalculatedWidth, fChildSuppliedWidth); - } else { - if (fHiddenContentCalculatedWidth < fChildSuppliedWidth && - m_pCurChildNode->GetElementType() != XFA_Element::Subform) { - fHiddenContentCalculatedWidth = fChildSuppliedWidth; - } - } - } - - if (bContainerHeightAutoSize) { - float fChildSuppliedHeight = absolutePos.y + size.height; - if (bChangeParentSize) { - fContentCalculatedHeight = - std::max(fContentCalculatedHeight, fChildSuppliedHeight); - } else { - if (fHiddenContentCalculatedHeight < fChildSuppliedHeight && - m_pCurChildNode->GetElementType() != XFA_Element::Subform) { - fHiddenContentCalculatedHeight = fChildSuppliedHeight; - } - } - } - m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); - } - - XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode(); - if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207) - fContentCalculatedWidth = fHiddenContentCalculatedWidth; - if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207) - fContentCalculatedHeight = fHiddenContentCalculatedHeight; - - containerSize = CalculateContainerComponentSizeFromContentSize( - m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, - bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); - SetCurrentComponentSize(containerSize); -} - -void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { - if (m_pLayoutItem) - return; - if (!pLayoutNode) - pLayoutNode = m_pFormNode; - - ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); - - m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - bool bContainerWidthAutoSize = true; - bool bContainerHeightAutoSize = true; - CFX_SizeF containerSize = CalculateContainerSpecifiedSize( - m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); - float fContentCalculatedWidth = 0; - float fContentCalculatedHeight = 0; - CXFA_Node* pMarginNode = - m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - float fLeftInset = 0; - float fRightInset = 0; - if (pMarginNode) { - fLeftInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fRightInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - } - - float fContentWidthLimit = - bContainerWidthAutoSize ? FLT_MAX - : containerSize.width - fLeftInset - fRightInset; - CFX_WideStringC wsColumnWidths; - if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { - auto widths = SeparateStringW(wsColumnWidths.c_str(), - wsColumnWidths.GetLength(), L' '); - for (auto& width : widths) { - width.TrimLeft(L' '); - if (width.IsEmpty()) - continue; - - m_rgSpecifiedColumnWidths.push_back( - CXFA_Measurement(width.AsStringC()).ToUnit(XFA_UNIT_Pt)); - } - } - - int32_t iSpecifiedColumnCount = - pdfium::CollectionSize(m_rgSpecifiedColumnWidths); - CXFA_LayoutContext layoutContext; - layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; - CXFA_LayoutContext* pLayoutContext = - iSpecifiedColumnCount > 0 ? &layoutContext : nullptr; - if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { - GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, - false); - } - - for (; m_pCurChildNode; GotoNextContainerNode( - m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) { - layoutContext.m_bCurColumnWidthAvaiable = false; - layoutContext.m_fCurColumnWidth = 0; - if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container) - continue; - - auto pProcessor = pdfium::MakeUnique( - m_pCurChildNode, m_pPageMgr); - pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pLayoutContext); - if (!pProcessor->HasLayoutItem()) - continue; - - m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); - } - - int32_t iRowCount = 0; - int32_t iColCount = 0; - { - std::vector rgRowItems; - std::vector rgRowItemsSpan; - std::vector rgRowItemsWidth; - for (auto* pLayoutChild = - static_cast(m_pLayoutItem->m_pFirstChild); - pLayoutChild; pLayoutChild = static_cast( - pLayoutChild->m_pNextSibling)) { - if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform) - continue; - if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) - continue; - - XFA_ATTRIBUTEENUM eLayout = - pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - if (eLayout != XFA_ATTRIBUTEENUM_Row && - eLayout != XFA_ATTRIBUTEENUM_Rl_row) { - continue; - } - if (CXFA_ContentLayoutItem* pRowLayoutCell = - (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) { - rgRowItems.push_back(pRowLayoutCell); - int32_t iColSpan = - pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); - rgRowItemsSpan.push_back(iColSpan); - rgRowItemsWidth.push_back(pRowLayoutCell->m_sSize.width); - } - } - - iRowCount = pdfium::CollectionSize(rgRowItems); - iColCount = 0; - bool bMoreColumns = true; - while (bMoreColumns) { - bMoreColumns = false; - bool bAutoCol = false; - for (int32_t i = 0; i < iRowCount; i++) { - while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || - !XFA_ItemLayoutProcessor_IsTakingSpace( - rgRowItems[i]->m_pFormNode))) { - CXFA_ContentLayoutItem* pNewCell = - (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; - if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( - rgRowItems[i]->m_pFormNode)) { - pNewCell = nullptr; - } - rgRowItems[i] = pNewCell; - rgRowItemsSpan[i] = - pNewCell - ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) - : 0; - rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0; - } - CXFA_ContentLayoutItem* pCell = rgRowItems[i]; - if (!pCell) - continue; - - bMoreColumns = true; - if (rgRowItemsSpan[i] != 1) - continue; - - if (iColCount >= iSpecifiedColumnCount) { - int32_t c = iColCount + 1 - pdfium::CollectionSize( - m_rgSpecifiedColumnWidths); - for (int32_t j = 0; j < c; j++) - m_rgSpecifiedColumnWidths.push_back(0); - } - if (m_rgSpecifiedColumnWidths[iColCount] < XFA_LAYOUT_FLOAT_PERCISION) - bAutoCol = true; - if (bAutoCol && - m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) { - m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i]; - } - } - - if (!bMoreColumns) - continue; - - float fFinalColumnWidth = 0.0f; - if (pdfium::IndexInBounds(m_rgSpecifiedColumnWidths, iColCount)) - fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount]; - - for (int32_t i = 0; i < iRowCount; ++i) { - if (!rgRowItems[i]) - continue; - --rgRowItemsSpan[i]; - rgRowItemsWidth[i] -= fFinalColumnWidth; - } - ++iColCount; - } - } - - float fCurrentRowY = 0; - for (CXFA_ContentLayoutItem* pLayoutChild = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - pLayoutChild; - pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { - if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) - continue; - - if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) { - XFA_ATTRIBUTEENUM eSubformLayout = - pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - if (eSubformLayout == XFA_ATTRIBUTEENUM_Row || - eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) { - RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths, - eSubformLayout); - } - } - - pLayoutChild->m_sPos.y = fCurrentRowY; - if (bContainerWidthAutoSize) { - pLayoutChild->m_sPos.x = 0; - } else { - switch (pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { - case XFA_ATTRIBUTEENUM_Center: - pLayoutChild->m_sPos.x = - (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2; - break; - case XFA_ATTRIBUTEENUM_Right: - pLayoutChild->m_sPos.x = - fContentWidthLimit - pLayoutChild->m_sSize.width; - break; - case XFA_ATTRIBUTEENUM_Left: - default: - pLayoutChild->m_sPos.x = 0; - break; - } - } - - if (bContainerWidthAutoSize) { - float fChildSuppliedWidth = - pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width; - if (fContentWidthLimit < FLT_MAX && - fContentWidthLimit > fChildSuppliedWidth) { - fChildSuppliedWidth = fContentWidthLimit; - } - fContentCalculatedWidth = - std::max(fContentCalculatedWidth, fChildSuppliedWidth); - } - fCurrentRowY += pLayoutChild->m_sSize.height; - } - - if (bContainerHeightAutoSize) - fContentCalculatedHeight = std::max(fContentCalculatedHeight, fCurrentRowY); - - containerSize = CalculateContainerComponentSizeFromContentSize( - m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, - bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); - SetCurrentComponentSize(containerSize); -} - -bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( - CXFA_ContentLayoutItem* pTrailerItem) { - if (!pTrailerItem) - return false; - - float fWidth = pTrailerItem->m_sSize.width; - XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); - return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth; -} - -float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { - if (m_arrayKeepItems.empty()) - return 0; - - if (!m_pLayoutItem) { - m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - m_pLayoutItem->m_sSize.clear(); - } - - float fTotalHeight = 0; - for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend(); - iter++) { - AddLeaderAfterSplit(this, *iter); - fTotalHeight += (*iter)->m_sSize.height; - } - m_arrayKeepItems.clear(); - - return fTotalHeight; -} - -bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( - CXFA_ItemLayoutProcessor* pParentProcessor, - CXFA_ItemLayoutProcessor* pChildProcessor, - XFA_ItemLayoutProcessorResult eRetValue, - std::vector* rgCurLineLayoutItem, - float* fContentCurRowAvailWidth, - float* fContentCurRowHeight, - float* fContentCurRowY, - bool* bAddedItemInRow, - bool* bForceEndPage, - XFA_ItemLayoutProcessorResult* result) { - if (!pParentProcessor || !pChildProcessor) - return false; - - if (pParentProcessor->m_pCurChildNode->GetIntact() == - XFA_ATTRIBUTEENUM_None && - pChildProcessor->m_bHasAvailHeight) - return false; - - if (!ExistContainerKeep(pParentProcessor->m_pCurChildNode, true)) - return false; - - CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize(); - std::vector keepLayoutItems; - if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, - childSize.height, &keepLayoutItems)) { - m_arrayKeepItems.clear(); - - for (auto* item : keepLayoutItems) { - pParentProcessor->m_pLayoutItem->RemoveChild(item); - *fContentCurRowY -= item->m_sSize.height; - m_arrayKeepItems.push_back(item); - } - *bAddedItemInRow = true; - *bForceEndPage = true; - *result = XFA_ItemLayoutProcessorResult::PageFullBreak; - return true; - } - - rgCurLineLayoutItem->push_back(pChildProcessor->ExtractLayoutItem()); - *bAddedItemInRow = true; - *fContentCurRowAvailWidth -= childSize.width; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); - *result = eRetValue; - - return true; -} - -bool CXFA_ItemLayoutProcessor::JudgePutNextPage( - CXFA_ContentLayoutItem* pParentLayoutItem, - float fChildHeight, - std::vector* pKeepItems) { - if (!pParentLayoutItem) - return false; - - float fItemsHeight = 0; - for (CXFA_ContentLayoutItem* pChildLayoutItem = - (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; - pChildLayoutItem; - pChildLayoutItem = - (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { - if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) { - pKeepItems->push_back(pChildLayoutItem); - fItemsHeight += pChildLayoutItem->m_sSize.height; - } else { - pKeepItems->clear(); - fItemsHeight = 0; - } - } - fItemsHeight += fChildHeight; - return m_pPageMgr->GetNextAvailContentHeight(fItemsHeight); -} - -void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) { - if (!pFormNode) - return; - - CXFA_NodeIteratorTemplate sIterator( - pFormNode); - for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; - pNode = sIterator.MoveToNext()) { - if (pNode->IsContainerNode()) { - CXFA_Node* pBindNode = pNode->GetBindData(); - if (pBindNode) { - pBindNode->RemoveBindItem(pNode); - pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); - } - } - pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); - } -} - -void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( - CXFA_Node* pLeaderNode, - CXFA_Node* pTrailerNode, - CXFA_ContentLayoutItem* pTrailerItem, - CXFA_Node* pFormNode) { - ProcessUnUseBinds(pLeaderNode); - ProcessUnUseBinds(pTrailerNode); - if (!pFormNode) - return; - - if (pFormNode->GetElementType() == XFA_Element::Overflow || - pFormNode->GetElementType() == XFA_Element::Break) { - pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); - } - if (pLeaderNode && pFormNode) - pFormNode->RemoveChild(pLeaderNode); - if (pTrailerNode && pFormNode) - pFormNode->RemoveChild(pTrailerNode); - if (pTrailerItem) - XFA_ReleaseLayoutItem(pTrailerItem); -} - -XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( - bool bUseBreakControl, - XFA_ATTRIBUTEENUM eFlowStrategy, - float fHeightLimit, - float fRealHeight, - CXFA_LayoutContext* pContext, - bool bRootForceTb) { - m_bHasAvailHeight = true; - bool bBreakDone = false; - bool bContainerWidthAutoSize = true; - bool bContainerHeightAutoSize = true; - bool bForceEndPage = false; - bool bIsManualBreak = false; - if (m_pCurChildPreprocessor) { - m_pCurChildPreprocessor->m_ePreProcessRs = - XFA_ItemLayoutProcessorResult::Done; - } - - CFX_SizeF containerSize = CalculateContainerSpecifiedSize( - m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); - if (pContext && pContext->m_bCurColumnWidthAvaiable) { - bContainerWidthAutoSize = false; - containerSize.width = pContext->m_fCurColumnWidth; - } - if (!bContainerHeightAutoSize) - containerSize.height -= m_fUsedSize; - - if (!bContainerHeightAutoSize) { - CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent); - bool bFocrTb = false; - if (pParentNode && - GetLayout(pParentNode, &bFocrTb) == XFA_ATTRIBUTEENUM_Row) { - CXFA_Node* pChildContainer = m_pFormNode->GetNodeItem( - XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); - if (pChildContainer && - pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, - XFA_ObjectType::ContainerNode)) { - containerSize.height = 0; - bContainerHeightAutoSize = true; - } - } - } - - CXFA_Node* pMarginNode = - m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - float fLeftInset = 0; - float fTopInset = 0; - float fRightInset = 0; - float fBottomInset = 0; - if (pMarginNode) { - fLeftInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fTopInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); - fRightInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - fBottomInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); - } - float fContentWidthLimit = - bContainerWidthAutoSize ? FLT_MAX - : containerSize.width - fLeftInset - fRightInset; - float fContentCalculatedWidth = 0; - float fContentCalculatedHeight = 0; - float fAvailHeight = fHeightLimit - fTopInset - fBottomInset; - if (fAvailHeight < 0) - m_bHasAvailHeight = false; - - fRealHeight = fRealHeight - fTopInset - fBottomInset; - float fContentCurRowY = 0; - CXFA_ContentLayoutItem* pLayoutChild = nullptr; - if (m_pLayoutItem) { - if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done && - eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { - pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; - pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { - if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y) - pLayoutChild = pLayoutNext; - } - } - - for (CXFA_ContentLayoutItem* pLayoutTempChild = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - pLayoutTempChild != pLayoutChild; - pLayoutTempChild = - (CXFA_ContentLayoutItem*)pLayoutTempChild->m_pNextSibling) { - if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutTempChild->m_pFormNode)) - continue; - - fContentCalculatedWidth = std::max( - fContentCalculatedWidth, - pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.width); - fContentCalculatedHeight = std::max( - fContentCalculatedHeight, - pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.height); - } - - if (pLayoutChild) - fContentCurRowY = pLayoutChild->m_sPos.y; - else - fContentCurRowY = fContentCalculatedHeight; - } - - fContentCurRowY += InsertKeepLayoutItems(); - if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None) { - GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, - true); - } - - fContentCurRowY += InsertPendingItems(this, m_pFormNode); - if (m_pCurChildPreprocessor && - m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Container) { - if (ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) { - m_pKeepHeadNode = m_pCurChildNode; - m_bIsProcessKeep = true; - m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Keep; - } - } - - while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done) { - float fContentCurRowHeight = 0; - float fContentCurRowAvailWidth = fContentWidthLimit; - m_fWidthLimite = fContentCurRowAvailWidth; - std::vector rgCurLineLayoutItems[3]; - uint8_t uCurHAlignState = - (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2); - if (pLayoutChild) { - for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; - pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { - if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor && - m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) { - pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem; - m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext; - break; - } - uint8_t uHAlign = HAlignEnumToInt( - pLayoutNext->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)); - rgCurLineLayoutItems[uHAlign].push_back(pLayoutNext); - if (eFlowStrategy == XFA_ATTRIBUTEENUM_Lr_tb) { - if (uHAlign > uCurHAlignState) - uCurHAlignState = uHAlign; - } else if (uHAlign < uCurHAlignState) { - uCurHAlignState = uHAlign; - } - if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) { - if (pLayoutNext->m_sSize.height > fContentCurRowHeight) - fContentCurRowHeight = pLayoutNext->m_sSize.height; - fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width; - } - } - - if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild == - pLayoutChild) { - m_pLayoutItem->m_pFirstChild = nullptr; - } else { - CXFA_ContentLayoutItem* pLayoutNext = - (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; - for (; pLayoutNext; - pLayoutNext = - (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { - if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling == - pLayoutChild) { - pLayoutNext->m_pNextSibling = nullptr; - break; - } - } - } - - CXFA_ContentLayoutItem* pLayoutNextTemp = - (CXFA_ContentLayoutItem*)pLayoutChild; - while (pLayoutNextTemp) { - pLayoutNextTemp->m_pParent = nullptr; - CXFA_ContentLayoutItem* pSaveLayoutNext = - (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; - pLayoutNextTemp->m_pNextSibling = nullptr; - pLayoutNextTemp = pSaveLayoutNext; - } - pLayoutChild = nullptr; - } - - while (m_pCurChildNode) { - std::unique_ptr pProcessor; - bool bAddedItemInRow = false; - fContentCurRowY += InsertPendingItems(this, m_pFormNode); - switch (m_nCurChildNodeStage) { - case XFA_ItemLayoutProcessorStages::Keep: - case XFA_ItemLayoutProcessorStages::None: - break; - case XFA_ItemLayoutProcessorStages::BreakBefore: { - for (auto* item : m_arrayKeepItems) { - m_pLayoutItem->RemoveChild(item); - fContentCalculatedHeight -= item->m_sSize.height; - } - - CXFA_Node* pLeaderNode = nullptr; - CXFA_Node* pTrailerNode = nullptr; - bool bCreatePage = false; - if (!bUseBreakControl || !m_pPageMgr || - !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, true, - pLeaderNode, pTrailerNode, - bCreatePage) || - m_pFormNode->GetElementType() == XFA_Element::Form || - !bCreatePage) { - break; - } - - if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) - AddPendingNode(this, pLeaderNode, true); - - if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { - if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) - ->GetElementType() == XFA_Element::Form && - !m_pLayoutItem) { - AddPendingNode(this, pTrailerNode, true); - } else { - auto pTempProcessor = - pdfium::MakeUnique(pTrailerNode, - nullptr); - InsertFlowedItem( - this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.height, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, - FLT_MAX, fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, false); - } - } - GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, - m_pFormNode, true); - bForceEndPage = true; - bIsManualBreak = true; - goto SuspendAndCreateNewRow; - } - case XFA_ItemLayoutProcessorStages::BreakAfter: { - CXFA_Node* pLeaderNode = nullptr; - CXFA_Node* pTrailerNode = nullptr; - bool bCreatePage = false; - if (!bUseBreakControl || !m_pPageMgr || - !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, false, - pLeaderNode, pTrailerNode, - bCreatePage) || - m_pFormNode->GetElementType() == XFA_Element::Form) { - break; - } - - if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { - auto pTempProcessor = pdfium::MakeUnique( - pTrailerNode, nullptr); - InsertFlowedItem( - this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.height, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, - fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, - &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, - pContext, false); - } - if (!bCreatePage) { - if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { - CalculateRowChildPosition( - rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize, - bContainerWidthAutoSize, &fContentCalculatedWidth, - &fContentCalculatedHeight, &fContentCurRowY, - fContentCurRowHeight, fContentWidthLimit, false); - rgCurLineLayoutItems->clear(); - auto pTempProcessor = - pdfium::MakeUnique(pLeaderNode, - nullptr); - InsertFlowedItem( - this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.height, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, - FLT_MAX, fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, false); - } - } else { - if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) - AddPendingNode(this, pLeaderNode, true); - } - - GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, - m_pFormNode, true); - if (bCreatePage) { - bForceEndPage = true; - bIsManualBreak = true; - if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done) - bBreakDone = true; - } - goto SuspendAndCreateNewRow; - } - case XFA_ItemLayoutProcessorStages::BookendLeader: { - CXFA_Node* pLeaderNode = nullptr; - if (m_pCurChildPreprocessor) { - pProcessor.reset(m_pCurChildPreprocessor); - m_pCurChildPreprocessor = nullptr; - } else if (m_pPageMgr && - m_pPageMgr->ProcessBookendLeaderOrTrailer( - m_pCurChildNode, true, pLeaderNode)) { - pProcessor = pdfium::MakeUnique( - pLeaderNode, m_pPageMgr); - } - - if (pProcessor) { - if (InsertFlowedItem( - this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.height, - eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, - bUseBreakControl, fAvailHeight, fRealHeight, - fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, - false) != XFA_ItemLayoutProcessorResult::Done) { - goto SuspendAndCreateNewRow; - } else { - pProcessor.reset(); - } - } - break; - } - case XFA_ItemLayoutProcessorStages::BookendTrailer: { - CXFA_Node* pTrailerNode = nullptr; - if (m_pCurChildPreprocessor) { - pProcessor.reset(m_pCurChildPreprocessor); - m_pCurChildPreprocessor = nullptr; - } else if (m_pPageMgr && - m_pPageMgr->ProcessBookendLeaderOrTrailer( - m_pCurChildNode, false, pTrailerNode)) { - pProcessor = pdfium::MakeUnique( - pTrailerNode, m_pPageMgr); - } - if (pProcessor) { - if (InsertFlowedItem( - this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.height, - eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, - bUseBreakControl, fAvailHeight, fRealHeight, - fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, - false) != XFA_ItemLayoutProcessorResult::Done) { - goto SuspendAndCreateNewRow; - } else { - pProcessor.reset(); - } - } - break; - } - case XFA_ItemLayoutProcessorStages::Container: { - ASSERT(m_pCurChildNode->IsContainerNode()); - if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) - break; - if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && - XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { - bForceEndPage = true; - goto SuspendAndCreateNewRow; - } - if (!m_pCurChildNode->IsContainerNode()) - break; - - bool bNewRow = false; - if (m_pCurChildPreprocessor) { - pProcessor.reset(m_pCurChildPreprocessor); - m_pCurChildPreprocessor = nullptr; - bNewRow = true; - } else { - pProcessor = pdfium::MakeUnique( - m_pCurChildNode, m_pPageMgr); - } - - InsertPendingItems(pProcessor.get(), m_pCurChildNode); - XFA_ItemLayoutProcessorResult rs = InsertFlowedItem( - this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.height, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, - fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, bNewRow); - switch (rs) { - case XFA_ItemLayoutProcessorResult::ManualBreak: - bIsManualBreak = true; - case XFA_ItemLayoutProcessorResult::PageFullBreak: - bForceEndPage = true; - case XFA_ItemLayoutProcessorResult::RowFullBreak: - goto SuspendAndCreateNewRow; - case XFA_ItemLayoutProcessorResult::Done: - default: - fContentCurRowY += - InsertPendingItems(pProcessor.get(), m_pCurChildNode); - pProcessor.reset(); - } - break; - } - case XFA_ItemLayoutProcessorStages::Done: - break; - default: - break; - } - GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, - true); - if (bAddedItemInRow && eFlowStrategy == XFA_ATTRIBUTEENUM_Tb) - break; - else - continue; - SuspendAndCreateNewRow: - if (pProcessor) - m_pCurChildPreprocessor = pProcessor.release(); - break; - } - - CalculateRowChildPosition( - rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize, - bContainerWidthAutoSize, &fContentCalculatedWidth, - &fContentCalculatedHeight, &fContentCurRowY, fContentCurRowHeight, - fContentWidthLimit, bRootForceTb); - m_fWidthLimite = fContentCurRowAvailWidth; - if (bForceEndPage) - break; - } - - bool bRetValue = - m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done && - m_PendingNodes.empty(); - if (bBreakDone) - bRetValue = false; - - containerSize = CalculateContainerComponentSizeFromContentSize( - m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, - bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); - - if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || - bRetValue) { - if (!m_pLayoutItem) - m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - containerSize.height = std::max(containerSize.height, 0.f); - - SetCurrentComponentSize(containerSize); - if (bForceEndPage) - m_fUsedSize = 0; - else - m_fUsedSize += m_pLayoutItem->m_sSize.height; - } - - return bRetValue - ? XFA_ItemLayoutProcessorResult::Done - : (bIsManualBreak ? XFA_ItemLayoutProcessorResult::ManualBreak - : XFA_ItemLayoutProcessorResult::PageFullBreak); -} - -bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( - std::vector (&rgCurLineLayoutItems)[3], - XFA_ATTRIBUTEENUM eFlowStrategy, - bool bContainerHeightAutoSize, - bool bContainerWidthAutoSize, - float* fContentCalculatedWidth, - float* fContentCalculatedHeight, - float* fContentCurRowY, - float fContentCurRowHeight, - float fContentWidthLimit, - bool bRootForceTb) { - int32_t nGroupLengths[3] = {0, 0, 0}; - float fGroupWidths[3] = {0, 0, 0}; - int32_t nTotalLength = 0; - for (int32_t i = 0; i < 3; i++) { - nGroupLengths[i] = pdfium::CollectionSize(rgCurLineLayoutItems[i]); - for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) { - nTotalLength++; - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[i][j]->m_pFormNode)) { - fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width; - } - } - } - if (!nTotalLength) { - if (bContainerHeightAutoSize) { - *fContentCalculatedHeight = - std::min(*fContentCalculatedHeight, *fContentCurRowY); - } - return false; - } - if (!m_pLayoutItem) - m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - - if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { - float fCurPos; - fCurPos = 0; - for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { - if (bRootForceTb) { - rgCurLineLayoutItems[0][j]->m_sPos = CalculatePositionedContainerPos( - rgCurLineLayoutItems[0][j]->m_pFormNode, - rgCurLineLayoutItems[0][j]->m_sSize); - } else { - rgCurLineLayoutItems[0][j]->m_sPos = - CFX_PointF(fCurPos, *fContentCurRowY); - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[0][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width; - } - } - m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]); - m_fLastRowWidth = fCurPos; - } - fCurPos = (fContentWidthLimit + fGroupWidths[0] - fGroupWidths[1] - - fGroupWidths[2]) / - 2; - for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) { - if (bRootForceTb) { - rgCurLineLayoutItems[1][j]->m_sPos = CalculatePositionedContainerPos( - rgCurLineLayoutItems[1][j]->m_pFormNode, - rgCurLineLayoutItems[1][j]->m_sSize); - } else { - rgCurLineLayoutItems[1][j]->m_sPos = - CFX_PointF(fCurPos, *fContentCurRowY); - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[1][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width; - } - } - m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]); - m_fLastRowWidth = fCurPos; - } - fCurPos = fContentWidthLimit - fGroupWidths[2]; - for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) { - if (bRootForceTb) { - rgCurLineLayoutItems[2][j]->m_sPos = CalculatePositionedContainerPos( - rgCurLineLayoutItems[2][j]->m_pFormNode, - rgCurLineLayoutItems[2][j]->m_sSize); - } else { - rgCurLineLayoutItems[2][j]->m_sPos = - CFX_PointF(fCurPos, *fContentCurRowY); - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[2][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width; - } - } - m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]); - m_fLastRowWidth = fCurPos; - } - } else { - float fCurPos; - fCurPos = fGroupWidths[0]; - for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[0][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width; - } - rgCurLineLayoutItems[0][j]->m_sPos = - CFX_PointF(fCurPos, *fContentCurRowY); - m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]); - m_fLastRowWidth = fCurPos; - } - fCurPos = (fContentWidthLimit + fGroupWidths[0] + fGroupWidths[1] - - fGroupWidths[2]) / - 2; - for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) { - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[1][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width; - } - rgCurLineLayoutItems[1][j]->m_sPos = - CFX_PointF(fCurPos, *fContentCurRowY); - m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]); - m_fLastRowWidth = fCurPos; - } - fCurPos = fContentWidthLimit; - for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) { - if (XFA_ItemLayoutProcessor_IsTakingSpace( - rgCurLineLayoutItems[2][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width; - } - rgCurLineLayoutItems[2][j]->m_sPos = - CFX_PointF(fCurPos, *fContentCurRowY); - m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]); - m_fLastRowWidth = fCurPos; - } - } - m_fLastRowY = *fContentCurRowY; - *fContentCurRowY += fContentCurRowHeight; - if (bContainerWidthAutoSize) { - float fChildSuppliedWidth = fGroupWidths[0]; - if (fContentWidthLimit < FLT_MAX && - fContentWidthLimit > fChildSuppliedWidth) { - fChildSuppliedWidth = fContentWidthLimit; - } - *fContentCalculatedWidth = - std::max(*fContentCalculatedWidth, fChildSuppliedWidth); - } - if (bContainerHeightAutoSize) { - *fContentCalculatedHeight = - std::max(*fContentCalculatedHeight, *fContentCurRowY); - } - return true; -} - -CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( - CXFA_Node* pSubformSet) { - if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) { - CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); - while (pParent) { - if (pParent->GetElementType() != XFA_Element::SubformSet) - return pParent; - pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); - } - } - return pSubformSet; -} - -void CXFA_ItemLayoutProcessor::DoLayoutField() { - if (m_pLayoutItem) - return; - - ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); - m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - if (!m_pLayoutItem) - return; - - CXFA_Document* pDocument = m_pFormNode->GetDocument(); - CXFA_FFNotify* pNotify = pDocument->GetNotify(); - CFX_SizeF size(-1, -1); - pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height); - - int32_t nRotate = - FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); - nRotate = XFA_MapRotation(nRotate); - if (nRotate == 90 || nRotate == 270) - std::swap(size.width, size.height); - - SetCurrentComponentSize(size); -} - -XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( - bool bUseBreakControl, - float fHeightLimit, - float fRealHeight, - CXFA_LayoutContext* pContext) { - switch (m_pFormNode->GetElementType()) { - case XFA_Element::Subform: - case XFA_Element::Area: - case XFA_Element::ExclGroup: - case XFA_Element::SubformSet: { - bool bRootForceTb = false; - CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); - XFA_ATTRIBUTEENUM eLayoutStrategy = GetLayout(pLayoutNode, &bRootForceTb); - switch (eLayoutStrategy) { - case XFA_ATTRIBUTEENUM_Tb: - case XFA_ATTRIBUTEENUM_Lr_tb: - case XFA_ATTRIBUTEENUM_Rl_tb: - return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy, - fHeightLimit, fRealHeight, pContext, - bRootForceTb); - case XFA_ATTRIBUTEENUM_Position: - case XFA_ATTRIBUTEENUM_Row: - case XFA_ATTRIBUTEENUM_Rl_row: - default: - DoLayoutPositionedContainer(pContext); - m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done; - return XFA_ItemLayoutProcessorResult::Done; - case XFA_ATTRIBUTEENUM_Table: - DoLayoutTableContainer(pLayoutNode); - m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done; - return XFA_ItemLayoutProcessorResult::Done; - } - } - case XFA_Element::Draw: - case XFA_Element::Field: - DoLayoutField(); - m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done; - return XFA_ItemLayoutProcessorResult::Done; - case XFA_Element::ContentArea: - return XFA_ItemLayoutProcessorResult::Done; - default: - return XFA_ItemLayoutProcessorResult::Done; - } -} - -CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() { - return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height); -} - -void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) { - m_pLayoutItem->m_sPos = pos; -} - -void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(const CFX_SizeF& size) { - m_pLayoutItem->m_sSize = size; -} - -bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( - CXFA_Node* pFormNode) { - if (!pFormNode) - return false; - - CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); - if (!pTemplate) - pTemplate = pFormNode; - - CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur)); - int32_t iMax = NodeOccur.GetMax(); - if (iMax < 0) - return true; - - int32_t iCount = m_PendingNodesCount[pTemplate]; - if (iCount >= iMax) - return false; - - m_PendingNodesCount[pTemplate] = iCount + 1; - return true; -} diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/xfa_layout_itemlayout.h deleted file mode 100644 index 9b8cd2f31a..0000000000 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.h +++ /dev/null @@ -1,188 +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 - -#ifndef XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ -#define XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ - -#include - -#include -#include -#include -#include - -#include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_coordinates.h" -#include "xfa/fxfa/fxfa_basic.h" - -#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1) -#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f) - -class CXFA_ContainerLayoutItem; -class CXFA_ContentLayoutItem; -class CXFA_ItemLayoutProcessor; -class CXFA_LayoutPageMgr; -class CXFA_LayoutProcessor; -class CXFA_Node; - -enum class XFA_ItemLayoutProcessorResult { - Done, - PageFullBreak, - RowFullBreak, - ManualBreak, -}; - -enum class XFA_ItemLayoutProcessorStages { - None, - BookendLeader, - BreakBefore, - Keep, - Container, - BreakAfter, - BookendTrailer, - Done, -}; - -class CXFA_LayoutContext { - public: - CXFA_LayoutContext() - : m_prgSpecifiedColumnWidths(nullptr), - m_fCurColumnWidth(0), - m_bCurColumnWidthAvaiable(false), - m_pOverflowProcessor(nullptr), - m_pOverflowNode(nullptr) {} - ~CXFA_LayoutContext() {} - - std::vector* m_prgSpecifiedColumnWidths; - float m_fCurColumnWidth; - bool m_bCurColumnWidthAvaiable; - CXFA_ItemLayoutProcessor* m_pOverflowProcessor; - CXFA_Node* m_pOverflowNode; -}; - -bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode); - -class CXFA_ItemLayoutProcessor { - public: - static bool IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor, - CXFA_Node* pNode, - CXFA_Node* pParentNode); - - CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); - ~CXFA_ItemLayoutProcessor(); - - XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl, - float fHeightLimit, - float fRealHeight, - CXFA_LayoutContext* pContext); - void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem); - - CFX_SizeF GetCurrentComponentSize(); - CXFA_Node* GetFormNode() { return m_pFormNode; } - bool HasLayoutItem() const { return !!m_pLayoutItem; } - CXFA_ContentLayoutItem* ExtractLayoutItem(); - void SplitLayoutItem(float fSplitPos); - - float FindSplitPos(float fProposedSplitPos); - - bool ProcessKeepForSplit( - CXFA_ItemLayoutProcessor* pParentProcessor, - CXFA_ItemLayoutProcessor* pChildProcessor, - XFA_ItemLayoutProcessorResult eRetValue, - std::vector* rgCurLineLayoutItem, - float* fContentCurRowAvailWidth, - float* fContentCurRowHeight, - float* fContentCurRowY, - bool* bAddedItemInRow, - bool* bForceEndPage, - XFA_ItemLayoutProcessorResult* result); - void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode, - CXFA_Node* pTrailerNode, - CXFA_ContentLayoutItem* pTrailerItem, - CXFA_Node* pFormNode); - bool IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem); - bool JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode); - - CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode); - - CXFA_Node* m_pFormNode; - CXFA_ContentLayoutItem* m_pLayoutItem; - CXFA_Node* m_pCurChildNode; - float m_fUsedSize; - CXFA_LayoutPageMgr* m_pPageMgr; - std::list m_PendingNodes; - bool m_bBreakPending; - std::vector m_rgSpecifiedColumnWidths; - std::vector m_arrayKeepItems; - float m_fLastRowWidth; - float m_fLastRowY; - bool m_bUseInheriated; - XFA_ItemLayoutProcessorResult m_ePreProcessRs; - - private: - void SetCurrentComponentPos(const CFX_PointF& pos); - void SetCurrentComponentSize(const CFX_SizeF& size); - - void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem, - CXFA_ContentLayoutItem* pSecondParent, - float fSplitPos); - float InsertKeepLayoutItems(); - bool CalculateRowChildPosition( - std::vector (&rgCurLineLayoutItems)[3], - XFA_ATTRIBUTEENUM eFlowStrategy, - bool bContainerHeightAutoSize, - bool bContainerWidthAutoSize, - float* fContentCalculatedWidth, - float* fContentCalculatedHeight, - float* fContentCurRowY, - float fContentCurRowHeight, - float fContentWidthLimit, - bool bRootForceTb); - void ProcessUnUseBinds(CXFA_Node* pFormNode); - bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem, - float fChildHeight, - std::vector* pKeepItems); - - void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext); - void DoLayoutTableContainer(CXFA_Node* pLayoutNode); - XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( - bool bUseBreakControl, - XFA_ATTRIBUTEENUM eFlowStrategy, - float fHeightLimit, - float fRealHeight, - CXFA_LayoutContext* pContext, - bool bRootForceTb); - void DoLayoutField(); - - void GotoNextContainerNode(CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages& nCurStage, - CXFA_Node* pParentContainer, - bool bUsePageBreak); - - bool ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages& nCurStage, - CXFA_Node*& pNextContainer, - bool& bLastKeepNode); - - bool ProcessKeepNodesForBreakBefore(CXFA_Node*& pCurActionNode, - XFA_ItemLayoutProcessorStages& nCurStage, - CXFA_Node* pContainerNode); - - CXFA_Node* GetSubformSetParent(CXFA_Node* pSubformSet); - - bool m_bKeepBreakFinish; - bool m_bIsProcessKeep; - CXFA_Node* m_pKeepHeadNode; - CXFA_Node* m_pKeepTailNode; - CXFA_ContentLayoutItem* m_pOldLayoutItem; - CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor; - XFA_ItemLayoutProcessorStages m_nCurChildNodeStage; - std::map m_PendingNodesCount; - float m_fWidthLimite; - bool m_bHasAvailHeight; -}; - -#endif // XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp deleted file mode 100644 index a9ddbcec3c..0000000000 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ /dev/null @@ -1,394 +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/parser/xfa_locale.h" - -#include - -#include "core/fxcrt/fx_xml.h" -#include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_utils.h" - -static const wchar_t g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%"; -static const wchar_t g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99"; -static const wchar_t g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz"; -static const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz"; - -CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr pLocaleData) - : m_pLocaleData(std::move(pLocaleData)) {} - -CXFA_XMLLocale::~CXFA_XMLLocale() {} - -CFX_WideString CXFA_XMLLocale::GetName() const { - return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString(); -} - -void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const { - CFX_ByteString bsSymbols; - CFX_WideString wsName; - switch (eType) { - case FX_LOCALENUMSYMBOL_Decimal: - bsSymbols = "numberSymbols"; - wsName = L"decimal"; - break; - case FX_LOCALENUMSYMBOL_Grouping: - bsSymbols = "numberSymbols"; - wsName = L"grouping"; - break; - case FX_LOCALENUMSYMBOL_Percent: - bsSymbols = "numberSymbols"; - wsName = L"percent"; - break; - case FX_LOCALENUMSYMBOL_Minus: - bsSymbols = "numberSymbols"; - wsName = L"minus"; - break; - case FX_LOCALENUMSYMBOL_Zero: - bsSymbols = "numberSymbols"; - wsName = L"zero"; - break; - case FX_LOCALENUMSYMBOL_CurrencySymbol: - bsSymbols = "currencySymbols"; - wsName = L"symbol"; - break; - case FX_LOCALENUMSYMBOL_CurrencyName: - bsSymbols = "currencySymbols"; - wsName = L"isoname"; - break; - default: - return; - } - CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC()); - if (!pElement) { - return; - } - GetPattern(pElement, - CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1), - wsName.AsStringC(), wsNumSymbol); -} - -void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { - if (!m_pLocaleData) { - return; - } - CFX_ByteString bsSpace; - CXML_Element* pNumberSymbols = - m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols"); - if (!pNumberSymbols) { - return; - } - wsDtSymbol = pNumberSymbols->GetContent(0); -} - -void CXFA_XMLLocale::GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - bool bAbbr) const { - wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr); -} - -void CXFA_XMLLocale::GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - bool bAbbr) const { - wsDayName = GetCalendarSymbol("day", nWeek, bAbbr); -} - -void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, - bool bAM) const { - wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false); -} - -void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE* tz) const { - CXFA_TimeZoneProvider provider; - provider.GetTimeZone(tz); -} - -void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { - wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false); -} - -CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, - int index, - bool bAbbr) const { - CFX_ByteString pstrSymbolNames = symbol + "Names"; - CFX_WideString wsSymbolName = L""; - if (m_pLocaleData) { - CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols"); - if (pChild) { - CXML_Element* pSymbolNames = - pChild->GetElement("", pstrSymbolNames.AsStringC()); - if (pSymbolNames) { - if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) { - pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1); - } - if (pSymbolNames && (!!pSymbolNames->GetAttrInteger("abbr")) == bAbbr) { - CXML_Element* pSymbolName = - pSymbolNames->GetElement("", symbol, index); - if (pSymbolName) { - wsSymbolName = pSymbolName->GetContent(0); - } - } - } - } - } - return wsSymbolName; -} - -void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const { - CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns"); - if (!pElement) { - return; - } - CFX_WideString wsName; - switch (eType) { - case FX_LOCALEDATETIMESUBCATEGORY_Short: - wsName = L"short"; - break; - case FX_LOCALEDATETIMESUBCATEGORY_Default: - case FX_LOCALEDATETIMESUBCATEGORY_Medium: - wsName = L"med"; - break; - case FX_LOCALEDATETIMESUBCATEGORY_Full: - wsName = L"full"; - break; - case FX_LOCALEDATETIMESUBCATEGORY_Long: - wsName = L"long"; - break; - } - GetPattern(pElement, "datePattern", wsName.AsStringC(), wsPattern); -} - -void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const { - CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns"); - if (!pElement) { - return; - } - CFX_WideString wsName; - switch (eType) { - case FX_LOCALEDATETIMESUBCATEGORY_Short: - wsName = L"short"; - break; - case FX_LOCALEDATETIMESUBCATEGORY_Default: - case FX_LOCALEDATETIMESUBCATEGORY_Medium: - wsName = L"med"; - break; - case FX_LOCALEDATETIMESUBCATEGORY_Full: - wsName = L"full"; - break; - case FX_LOCALEDATETIMESUBCATEGORY_Long: - wsName = L"long"; - break; - } - GetPattern(pElement, "timePattern", wsName.AsStringC(), wsPattern); -} - -void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const { - CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns"); - if (!pElement) { - return; - } - switch (eType) { - case FX_LOCALENUMPATTERN_Percent: - wsPattern = g_FX_Percent; - break; - case FX_LOCALENUMPATTERN_Currency: - wsPattern = g_FX_Currency; - break; - case FX_LOCALENUMPATTERN_Decimal: - wsPattern = g_FX_Decimal; - break; - case FX_LOCALENUMPATTERN_Integer: - wsPattern = g_FX_Integer; - break; - } -} - -void CXFA_XMLLocale::GetPattern(CXML_Element* pElement, - const CFX_ByteStringC& bsTag, - const CFX_WideStringC& wsName, - CFX_WideString& wsPattern) const { - int32_t iCount = pElement->CountElements("", bsTag); - for (int32_t i = 0; i < iCount; i++) { - CXML_Element* pChild = pElement->GetElement("", bsTag, i); - if (pChild->GetAttrValue("name") == wsName) { - wsPattern = pChild->GetContent(0); - return; - } - } -} - -CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {} - -CXFA_NodeLocale::~CXFA_NodeLocale() {} - -CFX_WideString CXFA_NodeLocale::GetName() const { - return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name) - : nullptr); -} - -void CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const { - switch (eType) { - case FX_LOCALENUMSYMBOL_Decimal: - wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"decimal"); - break; - case FX_LOCALENUMSYMBOL_Grouping: - wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"grouping"); - break; - case FX_LOCALENUMSYMBOL_Percent: - wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"percent"); - break; - case FX_LOCALENUMSYMBOL_Minus: - wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"minus"); - break; - case FX_LOCALENUMSYMBOL_Zero: - wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"zero"); - break; - case FX_LOCALENUMSYMBOL_CurrencySymbol: - wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"symbol"); - break; - case FX_LOCALENUMSYMBOL_CurrencyName: - wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"isoname"); - break; - } -} - -void CXFA_NodeLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { - CXFA_Node* pSymbols = - m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols) - : nullptr; - wsDtSymbol = pSymbols ? pSymbols->GetContent() : CFX_WideString(); -} - -void CXFA_NodeLocale::GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - bool bAbbr) const { - wsMonthName = GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr); -} - -void CXFA_NodeLocale::GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - bool bAbbr) const { - wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr); -} - -void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, - bool bAM) const { - wsMeridiemName = - GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false); -} - -void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE* tz) const { - CXFA_TimeZoneProvider provider; - provider.GetTimeZone(tz); -} - -void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { - wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false); -} - -void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const { - switch (eType) { - case FX_LOCALEDATETIMESUBCATEGORY_Short: - wsPattern = GetSymbol(XFA_Element::DatePatterns, L"short"); - break; - case FX_LOCALEDATETIMESUBCATEGORY_Medium: - case FX_LOCALEDATETIMESUBCATEGORY_Default: - wsPattern = GetSymbol(XFA_Element::DatePatterns, L"med"); - break; - case FX_LOCALEDATETIMESUBCATEGORY_Full: - wsPattern = GetSymbol(XFA_Element::DatePatterns, L"full"); - break; - case FX_LOCALEDATETIMESUBCATEGORY_Long: - wsPattern = GetSymbol(XFA_Element::DatePatterns, L"long"); - break; - } -} - -void CXFA_NodeLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const { - switch (eType) { - case FX_LOCALEDATETIMESUBCATEGORY_Short: - wsPattern = GetSymbol(XFA_Element::TimePatterns, L"short"); - break; - case FX_LOCALEDATETIMESUBCATEGORY_Medium: - case FX_LOCALEDATETIMESUBCATEGORY_Default: - wsPattern = GetSymbol(XFA_Element::TimePatterns, L"med"); - break; - case FX_LOCALEDATETIMESUBCATEGORY_Full: - wsPattern = GetSymbol(XFA_Element::TimePatterns, L"full"); - break; - case FX_LOCALEDATETIMESUBCATEGORY_Long: - wsPattern = GetSymbol(XFA_Element::TimePatterns, L"long"); - break; - } -} - -void CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const { - switch (eType) { - case FX_LOCALENUMPATTERN_Percent: - wsPattern = g_FX_Percent; - break; - case FX_LOCALENUMPATTERN_Currency: - wsPattern = g_FX_Currency; - break; - case FX_LOCALENUMPATTERN_Decimal: - wsPattern = g_FX_Decimal; - break; - case FX_LOCALENUMPATTERN_Integer: - wsPattern = g_FX_Integer; - break; - } -} - -CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, - const CFX_WideStringC& wsName) const { - CXFA_Node* pChild = - pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; - while (pChild) { - CFX_WideString wsChild; - if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) { - if (wsChild == wsName) { - return pChild; - } - } - pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); - } - return nullptr; -} - -CFX_WideString CXFA_NodeLocale::GetSymbol( - XFA_Element eElement, - const CFX_WideStringC& symbol_type) const { - CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr; - CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type); - return pSymbol ? pSymbol->GetContent() : CFX_WideString(); -} - -CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, - int index, - bool bAbbr) const { - CXFA_Node* pCalendar = - m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols) - : nullptr; - if (pCalendar) { - CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); - for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { - if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { - CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown); - return pSymbol ? pSymbol->GetContent() : CFX_WideString(); - } - } - } - return CFX_WideString(); -} diff --git a/xfa/fxfa/parser/xfa_locale.h b/xfa/fxfa/parser/xfa_locale.h deleted file mode 100644 index ae3e4bd170..0000000000 --- a/xfa/fxfa/parser/xfa_locale.h +++ /dev/null @@ -1,97 +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 - -#ifndef XFA_FXFA_PARSER_XFA_LOCALE_H_ -#define XFA_FXFA_PARSER_XFA_LOCALE_H_ - -#include - -#include "xfa/fgas/localization/fgas_locale.h" -#include "xfa/fxfa/parser/xfa_object.h" - -class CXFA_XMLLocale : public IFX_Locale { - public: - explicit CXFA_XMLLocale(std::unique_ptr pLocaleData); - ~CXFA_XMLLocale() override; - - // IFX_Locale - CFX_WideString GetName() const override; - void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const override; - - void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; - void GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - bool bAbbr = true) const override; - void GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - bool bAbbr = true) const override; - void GetMeridiemName(CFX_WideString& wsMeridiemName, - bool bAM = true) const override; - void GetTimeZone(FX_TIMEZONE* tz) const override; - void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override; - - void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const override; - void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const override; - void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const override; - - private: - void GetPattern(CXML_Element* pElement, - const CFX_ByteStringC& bsTag, - const CFX_WideStringC& wsName, - CFX_WideString& wsPattern) const; - CFX_WideString GetCalendarSymbol(const CFX_ByteStringC& symbol, - int index, - bool bAbbr) const; - - std::unique_ptr m_pLocaleData; -}; - -class CXFA_NodeLocale : public IFX_Locale { - public: - explicit CXFA_NodeLocale(CXFA_Node* pLocale); - ~CXFA_NodeLocale() override; - - // IFX_Locale - CFX_WideString GetName() const override; - void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const override; - - void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; - void GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - bool bAbbr = true) const override; - void GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - bool bAbbr = true) const override; - void GetMeridiemName(CFX_WideString& wsMeridiemName, - bool bAM = true) const override; - void GetTimeZone(FX_TIMEZONE* tz) const override; - void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override; - - void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const override; - void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const override; - void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const override; - - private: - CXFA_Node* GetNodeByName(CXFA_Node* pParent, - const CFX_WideStringC& wsName) const; - CFX_WideString GetSymbol(XFA_Element eElement, - const CFX_WideStringC& symbol_type) const; - CFX_WideString GetCalendarSymbol(XFA_Element eElement, - int index, - bool bAbbr) const; - - CXFA_Node* const m_pLocale; -}; - -#endif // XFA_FXFA_PARSER_XFA_LOCALE_H_ diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp deleted file mode 100644 index 0cd64ea6dc..0000000000 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ /dev/null @@ -1,1274 +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/parser/xfa_localemgr.h" - -#include - -#include -#include - -#include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/fx_xml.h" -#include "core/fxge/cfx_gemodule.h" -#include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/xfa_locale.h" -#include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_utils.h" - -const uint8_t g_enUS_Locale[] = { - 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6E, 0x9B, 0x30, 0x14, 0x7D, 0x9F, 0xB4, - 0x7F, 0x40, 0xD6, 0x2A, 0xB5, 0x52, 0x56, 0x6F, 0x8F, 0xA9, 0x88, 0xA5, - 0x6C, 0x24, 0x9B, 0x3A, 0xD1, 0x55, 0x22, 0x55, 0xB5, 0xBE, 0x4C, 0x0E, - 0xDC, 0x05, 0x34, 0xB0, 0x23, 0x83, 0x37, 0x05, 0xED, 0xE3, 0x67, 0x07, - 0xC3, 0xC0, 0xF6, 0x24, 0xC2, 0x4B, 0x7C, 0xCF, 0x3D, 0xE7, 0xE6, 0xDE, - 0x63, 0x30, 0x84, 0x25, 0x4F, 0x69, 0x09, 0x01, 0xA3, 0x15, 0xAC, 0x10, - 0xB0, 0xEF, 0x4F, 0x09, 0x0A, 0x32, 0xA8, 0xD3, 0x15, 0xDA, 0xB0, 0x43, - 0x59, 0xD4, 0xF9, 0xF5, 0xBA, 0x02, 0x51, 0xA4, 0xF4, 0x06, 0x91, 0x50, - 0x53, 0x59, 0x46, 0x45, 0x72, 0xAA, 0xF6, 0xBC, 0xAC, 0x8D, 0xEA, 0x20, - 0xE0, 0xC0, 0x45, 0x41, 0x99, 0x62, 0x54, 0x9C, 0x35, 0xF9, 0x83, 0x82, - 0x6B, 0xB3, 0x26, 0xF7, 0x94, 0x49, 0x2A, 0x4E, 0x21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, 0xFF, 0x41, 0x98, - 0xC3, 0x75, 0x8A, 0x37, 0x86, 0x10, 0xAA, 0xD4, 0xAC, 0xC3, 0x4B, 0x35, - 0x98, 0xB0, 0xE8, 0x98, 0xAE, 0x30, 0x3D, 0x4F, 0xA2, 0x70, 0xCD, 0x94, - 0x66, 0x49, 0xE0, 0xB8, 0x16, 0xEB, 0xA3, 0xF2, 0xF4, 0x91, 0xA4, 0x0F, - 0xA3, 0x42, 0xCB, 0x96, 0x43, 0x12, 0xEA, 0x93, 0x21, 0x9B, 0x02, 0x73, - 0xD8, 0x68, 0x39, 0xA9, 0x1D, 0xFA, 0x8D, 0x55, 0xD2, 0xE3, 0xF1, 0x7D, - 0xD1, 0xCD, 0x33, 0x63, 0x51, 0xFC, 0x15, 0x0D, 0xCB, 0xBF, 0xC0, 0xE4, - 0x3D, 0x40}; -const uint8_t g_zhTW_Locale[] = { - 0x78, 0x9C, 0xED, 0x57, 0xCD, 0x4F, 0xD4, 0x40, 0x14, 0x3F, 0x63, 0xE2, - 0xFF, 0x30, 0x69, 0x20, 0xD5, 0x04, 0xA8, 0x1E, 0x21, 0xA5, 0xC9, 0xC6, - 0x45, 0x30, 0x58, 0x42, 0xEC, 0x46, 0x22, 0x17, 0x33, 0xDB, 0x0E, 0xDB, - 0xC2, 0xB6, 0x43, 0x66, 0xDB, 0xC0, 0xF6, 0x24, 0x12, 0x14, 0x14, 0x62, - 0xA2, 0xC4, 0x8F, 0x80, 0xE1, 0x64, 0x3C, 0x28, 0x89, 0x07, 0x0F, 0x2C, - 0x51, 0xFF, 0x1A, 0x76, 0x39, 0xFA, 0x2F, 0x38, 0xD3, 0x2F, 0xFA, 0xB1, - 0xB3, 0xD4, 0xC4, 0xA3, 0x7B, 0x9A, 0xF7, 0xDE, 0xEF, 0xF7, 0xE6, 0xBD, - 0xDF, 0xBC, 0x7D, 0xD9, 0x95, 0x9B, 0x58, 0x87, 0x4D, 0x04, 0x1C, 0x68, - 0xA3, 0x29, 0xC1, 0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 0x28, 0x93, 0x75, 0xC6, 0x63, 0x18, 0x18, 0x82, - 0x32, 0x5F, 0x1B, 0xA6, 0x2B, 0x29, 0x83, 0x18, 0xC0, 0xB2, 0x5A, 0x98, - 0x1D, 0x04, 0xA5, 0xB6, 0x58, 0xFD, 0x0B, 0x5A, 0xFA, 0x21, 0x0A, 0xA4, - 0x60, 0x27, 0x16, 0xEA, 0x66, 0x4B, 0xA0, 0xBD, 0x86, 0x96, 0xA1, 0x1E, - 0xAF, 0xE0, 0xD8, 0x8C, 0x72, 0x56, 0x0C, 0x5C, 0x47, 0x40, 0xA5, 0xAF, - 0x05, 0x34, 0xD7, 0x00, 0xF7, 0x05, 0xA9, 0x2F, 0x4C, 0x6D, 0xD3, 0x9F, - 0x90, 0x06, 0x58, 0xA0, 0x32, 0x72, 0x00, 0x96, 0x63, 0x61, 0x67, 0x00, - 0xE0, 0x0E, 0xF6, 0x88, 0x85, 0x08, 0xBB, 0x85, 0x83, 0x08, 0x4B, 0x59, - 0xB0, 0xAE, 0x84, 0xCC, 0xA2, 0x3A, 0x41, 0xEB, 0x03, 0x21, 0x15, 0x02, - 0xEB, 0xF4, 0x8B, 0x38, 0x08, 0x52, 0x33, 0xA1, 0xC5, 0x01, 0xCC, 0x61, - 0xDF, 0x5B, 0x85, 0x60, 0x06, 0xBB, 0xA6, 0xA5, 0xB3, 0x9E, 0xC6, 0x1E, - 0xDE, 0x03, 0xEA, 0x60, 0x30, 0x15, 0x40, 0x37, 0x71, 0x0C, 0x7E, 0x30, - 0xF0, 0x6A, 0x0D, 0x5F, 0x21, 0x77, 0xF4, 0x2A, 0x6D, 0xCF, 0x69, 0xAC, - 0xE0, 0x00, 0x19, 0xDE, 0x1E, 0x2C, 0xB6, 0xD4, 0x7B, 0xCA, 0x52, 0xF8, - 0x67, 0x41, 0xF9, 0x03, 0x11, 0xC2, 0x4A, 0xC9}; -const uint8_t g_zhHK_Locale[] = { - 0x78, 0x9C, 0xA5, 0x57, 0x4D, 0x4F, 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 0x41, 0x6D, 0x0D, - 0x2E, 0x4B, 0xB2, 0xF7, 0x4C, 0x7B, 0xA1, 0x5B, 0x73, 0x46, 0x41, 0x45, - 0x08, 0xF2, 0xE4, 0xB4, 0x40, 0xC1, 0x54, 0xC0, 0x6D, 0x2E, 0x95, 0x48, - 0xCB, 0xD7, 0xC8, 0xDF, 0x92, 0x0A, 0x58, 0x20, 0x36, 0x32, 0x08, 0x9A, - 0xA1, 0x21, 0xA3, 0x0B, 0xE1, 0x06, 0xAA, 0x62, 0x0D, 0x62, 0xBA, 0x0B, - 0x83, 0xE1, 0xB4, 0xB2, 0xA0, 0xF5, 0xA4, 0x64, 0x61, 0x11, 0xC3, 0xF5, - 0xAE, 0x94, 0x19, 0x2C, 0x15, 0xC9, 0x47, 0xD9, 0x8D, 0xB2, 0xA8, 0x4A, - 0x1A, 0x83, 0x90, 0x43, 0x56, 0x75, 0x55, 0x02, 0xF3, 0xC8, 0x54, 0x35, - 0x99, 0xCE, 0x34, 0x76, 0xEF, 0x16, 0xC8, 0x77, 0x27, 0x13, 0x03, 0x64, - 0x15, 0x79, 0xE4, 0xBB, 0x5D, 0xB7, 0x2E, 0xA0, 0x1E, 0x76, 0xBB, 0xA7, - 0x52, 0xAB, 0x1A, 0xA5, 0x15, 0x64, 0x33, 0x9D, 0xDD, 0xED, 0x47, 0x2E, - 0x70, 0x9E, 0x42, 0xCA, 0xF9, 0x27, 0x42, 0xFC, 0x0B, 0xD9, 0x0E, 0x4B, - 0xED}; -const uint8_t g_jaJP_Locale[] = { - 0x78, 0x9C, 0xED, 0x56, 0xCB, 0x6E, 0xD3, 0x40, 0x14, 0x5D, 0x17, 0x89, - 0x7F, 0x18, 0x59, 0x20, 0x83, 0xD4, 0xD6, 0x0D, 0xEF, 0x56, 0xAE, 0xA5, - 0x8A, 0x96, 0x86, 0x16, 0xA3, 0x08, 0x57, 0xA0, 0x76, 0x83, 0x26, 0xF6, - 0x34, 0x99, 0x36, 0x9E, 0xA9, 0x26, 0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xA3, 0x2C, 0xC1, 0xED, 0x42, 0x41, - 0x83, 0x51, 0x77, 0x07, 0x8B, 0xF9, 0x4F, 0x96, 0x54, 0xC4, 0x1D, 0x9C, - 0x2D, 0x29, 0xB0, 0x31, 0x71, 0xDB, 0x92, 0x36, 0x55, 0x92, 0xEE, 0x21, - 0x46, 0x25, 0x6D, 0x26, 0xC3, 0x1E, 0x1A, 0x93, 0x1A, 0x76, 0x34, 0x89, - 0x94, 0x33, 0x69, 0x30, 0xDA, 0x81, 0x7E, 0x20, 0x69, 0x7F, 0x0E, 0xF9, - 0x89, 0x9D, 0x66, 0x8C, 0x51, 0xE1, 0x36, 0x15, 0x0B, 0x49, 0x5B, 0xA9, - 0xAD, 0x9F, 0x40, 0x96, 0x1C, 0x44, 0x46, 0xE4, 0x1F, 0x7F, 0x99, 0xBA, - 0xC5, 0xDB, 0xDE, 0xD9, 0x41, 0x9B, 0xD0, 0x8C, 0x4E, 0xDB, 0x28, 0x0C, - 0x73, 0xAE, 0x52, 0xCF, 0xDD, 0x86, 0x60, 0x99, 0x3A, 0x4D, 0x6C, 0x82, - 0x1A, 0xA3, 0x53, 0x77, 0x6F, 0x02, 0x5D, 0x52, 0xC6, 0x91, 0x75, 0x4C, - 0xCC, 0x26, 0x8D, 0xC8, 0x77, 0x0A, 0xC8, 0x7A, 0x87, 0x7F, 0x2A, 0x5A, - 0x82, 0x55, 0x44, 0xC0, 0x04, 0x53, 0x32, 0x86, 0x70, 0x9D, 0xBA, 0x0C, - 0x23, 0x06, 0x0C, 0xC7, 0x2A, 0x60, 0x2C, 0x58, 0xB4, 0x8E, 0x40, 0x0D, - 0xFF, 0x93, 0x52, 0x45, 0x75, 0x86, 0x76, 0xC7, 0x52, 0x16, 0x18, 0xAC, - 0xF3, 0x17, 0x77, 0x1C, 0x65, 0xAD, 0x09, 0xF1, 0x58, 0x02, 0x6F, 0xA9, - 0x21, 0x6A, 0x01, 0xB7, 0xC6, 0xD2, 0x0C, 0x5A, 0x8A, 0xA6, 0x77, 0x5C, - 0xD2, 0xD8, 0xA2, 0x3E, 0x33, 0x18, 0x89, 0x7F, 0xAA, 0x25, 0xE6, 0xA9, - 0x2A, 0xC1, 0x87, 0xBD, 0xF6, 0x17, 0x6C, 0x42, 0x08, 0x21}; -const uint8_t g_koKR_Locale[] = { - 0x78, 0x9C, 0xED, 0x56, 0x4D, 0x6B, 0xD4, 0x40, 0x18, 0x3E, 0x57, 0xF0, - 0x3F, 0x0C, 0xC1, 0x12, 0x85, 0x76, 0xB7, 0xEB, 0x77, 0x4B, 0x1A, 0x28, - 0x6E, 0x6D, 0x65, 0x8D, 0x94, 0xA6, 0x58, 0xEC, 0x45, 0x66, 0x93, 0xE9, - 0x26, 0xED, 0x26, 0x53, 0x26, 0x09, 0x75, 0x73, 0xAE, 0x52, 0xF0, 0xE2, - 0xA1, 0x87, 0xEA, 0x6E, 0xB1, 0x07, 0x11, 0x2A, 0x88, 0x22, 0x22, 0x1E, - 0x14, 0x7F, 0x8D, 0x62, 0x6D, 0x8A, 0x7F, 0xC1, 0xC9, 0xE7, 0xE6, 0x63, - 0xB2, 0x4D, 0xEF, 0xEE, 0x61, 0x99, 0xF7, 0x99, 0xE7, 0x79, 0xF3, 0xBE, - 0xCF, 0x4C, 0x5E, 0x22, 0x74, 0xB1, 0x02, 0xBB, 0x08, 0x98, 0xD0, 0x40, - 0xB3, 0xDC, 0x26, 0x7E, 0xDC, 0x5A, 0xE6, 0x80, 0x8A, 0x2C, 0x65, 0x96, - 0xFB, 0x35, 0x38, 0x38, 0xFE, 0x34, 0xF8, 0xFD, 0xE1, 0xFD, 0xE5, 0xE3, - 0xD7, 0x47, 0x3F, 0xFB, 0xDF, 0xAF, 0x70, 0xE2, 0xC5, 0x0B, 0x00, 0x08, - 0x3E, 0xDF, 0x54, 0x21, 0x91, 0x7B, 0x46, 0x1B, 0x77, 0xAD, 0x48, 0xDA, - 0x21, 0xA8, 0x83, 0x89, 0x0E, 0x4D, 0x9F, 0x35, 0x06,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, 0x27, 0x22, 0x4B, 0x2F, - 0x09, 0x3A, 0x16, 0x49, 0xC0, 0xBC, 0x7C, 0x8E, 0xED, 0x57, 0x4F, 0x91, - 0xBB, 0x8E, 0x0A, 0x23, 0x7B, 0x81, 0x28, 0xA9, 0xA7, 0x6B, 0x6E, 0x0A, - 0xCC, 0x49, 0x3E, 0x19, 0x7A, 0xBE, 0x86, 0x34, 0x12, 0x1D, 0x48, 0xEE, - 0x22, 0xE5, 0x93, 0xA9, 0x58, 0xF2, 0x54, 0x73, 0xF8, 0x76, 0xCF, 0xF2, - 0xA8, 0xF8, 0xD2, 0x85, 0xE5, 0x3F, 0x5D, 0x49, 0xBE, 0x1B}; -const uint8_t g_itIT_Locale[] = { - 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6A, 0xD4, 0x40, 0x14, 0x7D, 0x17, 0xFC, - 0x87, 0x21, 0x58, 0x50, 0x68, 0x3B, 0xFA, 0xD8, 0x92, 0x06, 0x4A, 0x5B, - 0xBB, 0xA5, 0x46, 0x96, 0xEE, 0xAA, 0xD8, 0x17, 0x99, 0x64, 0xA6, 0xD9, - 0xB1, 0xC9, 0xCC, 0x32, 0x49, 0x5A, 0x92, 0x47, 0xF1, 0xC1, 0x37, 0x7F, - 0x42, 0x10, 0x41, 0xF1, 0x23, 0xFC, 0x13, 0xA1, 0xE2, 0x67, 0x78, 0xB3, - 0x99, 0xA4, 0xC9, 0x64, 0xBA, 0xA6, 0x79, 0xD9, 0xB9, 0xE7, 0x9E, 0x73, - 0x73, 0xEF, 0x99, 0x64, 0x36, 0x6E, 0x2C, 0x43, 0x12, 0x33, 0x24, 0x48, - 0xC2, 0xF6, 0x1C, 0x9E, 0xBD, 0x3B, 0x99, 0x3B, 0x88, 0xB2, 0x34, 0xDC, - 0x73, 0xFE, 0x7C, 0xFC, 0x7C, 0xF3, 0xE5, 0xEB, 0xCD, 0xA7, 0x6F, 0x7F, - 0x7F, 0xFE, 0x78, 0xDC, 0x06, 0x4F, 0x1C, 0xCF, 0xAD, 0x14, 0x82, 0x12, - 0x35, 0x2B, 0x92, 0x40, 0xC6, 0xA9, 0x16, 0x47, 0x8A, 0x45, 0x52, 0x71, - 0x22, 0x80, 0x91, 0x48, 0x91, 0x2D, 0x5E, 0x02, 0x9C, 0xEA, 0xB5, 0x17, - 0x31, 0x21, 0x08, 0x97, 0x2E, 0xAE, 0xC3, 0x87, 0x0F, 0x34, 0x7E, 0xC1, - 0x82, 0x40, 0xD9, 0x12, 0x09, 0x51, 0xE5, 0x10, 0x25, 0x4B, 0xC5, 0x63, - 0x66, 0x21, 0x47, 0x91, 0xA5, 0x46, 0xC4, 0xF3, 0x48, 0x0C, 0xE1, 0x38, - 0x8F, 0x62, 0x0B, 0x9B, 0x44, 0x32, 0xCD, 0x86, 0x70, 0xCA, 0xB2, 0x8C, - 0x25, 0x81, 0x1A, 0xDE, 0x55, 0x66, 0x99, 0xB4, 0xE1, 0x42, 0x5E, 0xD9, - 0x05, 0x94, 0x87, 0x66, 0x02, 0x77, 0xAC, 0x6A, 0x78, 0xAB, 0x08, 0x11, - 0x30, 0x66, 0xCF, 0x79, 0xE6, 0x74, 0x1C, 0xB4, 0xB9, 0x67, 0x33, 0xCE, - 0x66, 0x9B, 0xCD, 0x33, 0x9B, 0x61, 0x36, 0xB7, 0x6C, 0x56, 0xD9, 0x7C, - 0xB2, 0x39, 0x64, 0x73, 0xC7, 0x66, 0xCC, 0xDD, 0x9E, 0x50, 0x52, 0xE8, - 0x47, 0x09, 0x56, 0x1E, 0x95, 0x09, 0x13, 0x3C, 0x24, 0x2E, 0xAE, 0xA2, - 0x3A, 0x0D, 0x3D, 0x0A, 0x46, 0x7F, 0x7D, 0xEF, 0x61, 0xE0, 0x43, 0x36, - 0x04, 0x99, 0x0A, 0x65, 0x3C, 0x80, 0xE1, 0xE1, 0xB9, 0x1A, 0x80, 0x57, - 0x4C, 0x30, 0x65, 0x82, 0x29, 0x09, 0x48, 0xF5, 0x90, 0x68, 0x08, 0xB7,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xE5, - 0x17, 0xF0, 0x95, 0x43, 0xD1, 0x14, 0xBC, 0xC0, 0x5D, 0x66, 0x93, 0xE6, - 0x82, 0x4B, 0x71, 0x67, 0xFA, 0x40, 0xE6, 0x8A, 0x33, 0x85, 0x66, 0x19, - 0xB5, 0xE6, 0xF7, 0xA9, 0x0C, 0x18, 0x9A, 0xF2, 0xFF, 0x10, 0x26, 0x0C, - 0xBE, 0x23, 0xAE, 0xD7, 0x10, 0xF6, 0x15, 0x09, 0xE0, 0x85, 0xB9, 0x9B, - 0x30, 0x5F, 0x10, 0x6E, 0x4D, 0x9F, 0xCA, 0x32, 0xBF, 0x24, 0xE8, 0x58, - 0x66, 0x0B, 0x1E, 0x56, 0x73, 0x6C, 0xBD, 0x3E, 0x41, 0xFE, 0x3A, 0x2A, - 0x8C, 0x1C, 0x2E, 0x64, 0x43, 0x3D, 0x5B, 0x73, 0x53, 0x60, 0x46, 0xD5, - 0x64, 0xE8, 0xC5, 0x1A, 0xD2, 0x4C, 0x8E, 0x20, 0xF9, 0x45, 0x2E, 0xA2, - 0xF7, 0x72, 0xC5, 0xD3, 0xCD, 0xE1, 0xDB, 0x3D, 0xAB, 0xA2, 0xFA, 0xD3, - 0x16, 0x96, 0xFF, 0x00, 0x20, 0x8B, 0xBE, 0xF7}; -const uint8_t g_ptBR_Locale[] = { - 0x78, 0x9C, 0x9D, 0x56, 0x3D, 0x6F, 0xD4, 0x40, 0x10, 0xAD, 0x83, 0xC4, - 0x7F, 0x58, 0x59, 0x89, 0x0E, 0xA4, 0x24, 0x86, 0x92, 0xC8, 0x67, 0xE9, - 0x92, 0x0B, 0x39, 0x94, 0x18, 0x9D, 0xCE, 0x11, 0x88, 0x34, 0x68, 0x6D, - 0xEF, 0xD9, 0x9B, 0xD8, 0xBB, 0xC7, 0xDA, 0x4E, 0xB0, 0x6B, 0x1A, 0x3A, - 0x28, 0x29, 0x53, 0x20, 0x2A, 0x44, 0x83, 0x44, 0x49, 0x91, 0xDF, 0x82, - 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04, 0x67, 0xBD, 0x30, 0x9D, 0x0E, 0x82, 0x69, 0x51, - 0x48, 0xEC, 0x4B, 0x9A, 0x22, 0xB3, 0x24, 0xD3, 0xC1, 0x56, 0x39, 0x4F, - 0x45, 0xCE, 0xFE, 0xF7, 0xD5, 0x3F, 0x30, 0xBB, 0xD9, 0x9B}; -const uint8_t g_nlNL_Locale[] = { - 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x4F, 0xDC, 0x30, 0x10, 0x3D, 0x53, 0xA9, - 0xFF, 0xC1, 0x8A, 0x8A, 0x68, 0x25, 0x96, 0x2D, 0x47, 0x50, 0x88, 0xB4, - 0x05, 0x0A, 0x15, 0x04, 0xAD, 0x58, 0xDA, 0xAA, 0x5C, 0x2A, 0x6F, 0x62, - 0x76, 0xBD, 0x24, 0xF6, 0xCA, 0x89, 0x41, 0xC9, 0xB1, 0x52, 0x8F, 0xFD, - 0x27, 0xAD, 0xDA, 0x5B, 0xFF, 0x4F, 0xA5, 0x4A, 0xFC, 0x8C, 0x8E, 0xF3, - 0x45, 0x12, 0x3B, 0x69, 0xC8, 0x05, 0xCF, 0x9B, 0xF7, 0xBC, 0x33, 0xCF, - 0xCE, 0x10, 0x3B, 0xE0, 0x1E, 0x0E, 0x08, 0x62, 0x38, 0x24, 0x07, 0x16, - 0x0B, 0x3E, 0x5F, 0x9C, 0x5B, 0xC8, 0x27, 0x91, 0x77, 0x60, 0x3D, 0x7C, - 0xFB, 0xFD, 0xF7, 0xEB, 0xAF, 0x87, 0x9F, 0x3F, 0x5E, 0xE6, 0xAB, 0x57, - 0x96, 0xF3, 0xFC, 0x19, 0x42, 0xB6, 0xE2, 0x33, 0x1F, 0x8B, 0x59, 0x12, - 0xCE, 0x79, 0x10, 0x15, 0xD2, 0x85, 0x20, 0x0B, 0x2E, 0x28, 0x66, 0x8A, - 0xB5, 0x81, 0xEC, 0x90, 0xB3, 0x78, 0x79, 0x01, 0xA9, 0x48, 0xC5, 0x1B, - 0x79, 0xEC, 0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E, 0x4A, 0x59, 0xC0, 0x55, 0x8A, 0xB7, 0x72, 0x29, 0xB3, 0x54, - 0xAE, 0xC2, 0x23, 0x96, 0x47, 0x59, 0xAE, 0xCB, 0x5A, 0x06, 0x61, 0x91, - 0xD8, 0xD6, 0x86, 0x8C, 0xE6, 0x89, 0x59, 0xD7, 0x14, 0x9E, 0xD3, 0xD4, - 0xB3, 0xC7, 0x48, 0xCA, 0x27, 0x43, 0x01, 0x94, 0x3A, 0x09, 0xC8, 0xE5, - 0xDC, 0xA3, 0x81, 0x5B, 0xE3, 0x59, 0xA2, 0x27, 0xB9, 0xB4, 0x0A, 0x19, - 0x89, 0x26, 0xB5, 0x2C, 0xA3, 0xB6, 0x4E, 0x5C, 0xA6, 0x17, 0xA4, 0x7B, - 0xB3, 0x85, 0xFA, 0x59, 0x2A, 0x7A, 0xFF, 0x3D, 0xC4, 0x3F, 0xDE, 0xCB, - 0x8B, 0xC4}; - -static std::unique_ptr XFA_GetLocaleFromBuffer(const uint8_t* pBuf, - int nBufLen) { - if (!pBuf || nBufLen <= 0) - return nullptr; - CFX_GEModule* pGeModule = CFX_GEModule::Get(); - if (!pGeModule) - return nullptr; - - CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); - if (!pCodecMgr) - return nullptr; - - std::unique_ptr pLocale; - uint8_t* pOut = nullptr; - uint32_t dwSize; - pCodecMgr->GetFlateModule()->FlateOrLZWDecode(false, pBuf, nBufLen, true, 0, - 0, 0, 0, 0, pOut, dwSize); - if (pOut) { - pLocale = CXML_Element::Parse(pOut, dwSize); - FX_Free(pOut); - } - return pLocale ? std::unique_ptr( - new CXFA_XMLLocale(std::move(pLocale))) - : nullptr; -} - -static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { - uint16_t dwLangueID = XFA_LANGID_en_US; - if (wsLanguage.GetLength() < 2) { - return dwLangueID; - } - wsLanguage.MakeLower(); - uint32_t dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1); - uint32_t dwIDSecond = wsLanguage.GetLength() >= 5 - ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4) - : 0; - switch (dwIDFirst) { - case FXBSTR_ID(0, 0, 'z', 'h'): { - if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) { - dwLangueID = XFA_LANGID_zh_CN; - } else if (dwIDSecond == FXBSTR_ID(0, 0, 't', 'w')) { - dwLangueID = XFA_LANGID_zh_TW; - } else if (dwIDSecond == FXBSTR_ID(0, 0, 'h', 'k')) { - dwLangueID = XFA_LANGID_zh_HK; - } - } break; - case FXBSTR_ID(0, 0, 'j', 'a'): - dwLangueID = XFA_LANGID_ja_JP; - break; - case FXBSTR_ID(0, 0, 'k', 'o'): - dwLangueID = XFA_LANGID_ko_KR; - break; - case FXBSTR_ID(0, 0, 'e', 'n'): { - if (dwIDSecond == FXBSTR_ID(0, 0, 'g', 'b')) { - dwLangueID = XFA_LANGID_en_GB; - } else { - dwLangueID = XFA_LANGID_en_US; - } - } break; - case FXBSTR_ID(0, 0, 'd', 'e'): - dwLangueID = XFA_LANGID_de_DE; - break; - case FXBSTR_ID(0, 0, 'f', 'r'): - dwLangueID = XFA_LANGID_fr_FR; - break; - case FXBSTR_ID(0, 0, 'e', 's'): { - if (dwIDSecond == FXBSTR_ID(0, 0, 'e', 's')) { - dwLangueID = XFA_LANGID_es_ES; - } else { - dwLangueID = XFA_LANGID_es_LA; - } - } break; - case FXBSTR_ID(0, 0, 'i', 't'): - dwLangueID = XFA_LANGID_it_IT; - break; - case FXBSTR_ID(0, 0, 'p', 't'): - dwLangueID = XFA_LANGID_pt_BR; - break; - case FXBSTR_ID(0, 0, 'n', 'l'): - dwLangueID = XFA_LANGID_nl_NL; - break; - case FXBSTR_ID(0, 0, 'r', 'u'): - dwLangueID = XFA_LANGID_ru_RU; - break; - } - return dwLangueID; -} - -CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) - : m_dwLocaleFlags(0x00) { - m_dwDeflcid = XFA_GetLanguage(wsDeflcid); - if (pLocaleSet) { - CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild); - while (pNodeLocale) { - m_LocaleArray.emplace_back(new CXFA_NodeLocale(pNodeLocale)); - pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); - } - } - m_pDefLocale = GetLocaleByName(wsDeflcid); -} - -CXFA_LocaleMgr::~CXFA_LocaleMgr() {} - -uint16_t CXFA_LocaleMgr::GetDefLocaleID() const { - return m_dwDeflcid; -} - -IFX_Locale* CXFA_LocaleMgr::GetDefLocale() { - if (m_pDefLocale) - return m_pDefLocale; - - if (!m_LocaleArray.empty()) - return m_LocaleArray[0].get(); - - if (!m_XMLLocaleArray.empty()) - return m_XMLLocaleArray[0].get(); - - std::unique_ptr locale(GetLocale(m_dwDeflcid)); - m_pDefLocale = locale.get(); - if (locale) - m_XMLLocaleArray.push_back(std::move(locale)); - - return m_pDefLocale; -} - -std::unique_ptr CXFA_LocaleMgr::GetLocale(uint16_t lcid) { - switch (lcid) { - case XFA_LANGID_zh_CN: - return XFA_GetLocaleFromBuffer(g_zhCN_Locale, sizeof(g_zhCN_Locale)); - case XFA_LANGID_zh_TW: - return XFA_GetLocaleFromBuffer(g_zhTW_Locale, sizeof(g_zhTW_Locale)); - case XFA_LANGID_zh_HK: - return XFA_GetLocaleFromBuffer(g_zhHK_Locale, sizeof(g_zhHK_Locale)); - case XFA_LANGID_ja_JP: - return XFA_GetLocaleFromBuffer(g_jaJP_Locale, sizeof(g_jaJP_Locale)); - case XFA_LANGID_ko_KR: - return XFA_GetLocaleFromBuffer(g_koKR_Locale, sizeof(g_koKR_Locale)); - case XFA_LANGID_en_GB: - return XFA_GetLocaleFromBuffer(g_enGB_Locale, sizeof(g_enGB_Locale)); - case XFA_LANGID_es_LA: - return XFA_GetLocaleFromBuffer(g_esLA_Locale, sizeof(g_esLA_Locale)); - case XFA_LANGID_es_ES: - return XFA_GetLocaleFromBuffer(g_esES_Locale, sizeof(g_esES_Locale)); - case XFA_LANGID_de_DE: - return XFA_GetLocaleFromBuffer(g_deDE_Loacale, sizeof(g_deDE_Loacale)); - case XFA_LANGID_fr_FR: - return XFA_GetLocaleFromBuffer(g_frFR_Locale, sizeof(g_frFR_Locale)); - case XFA_LANGID_it_IT: - return XFA_GetLocaleFromBuffer(g_itIT_Locale, sizeof(g_itIT_Locale)); - case XFA_LANGID_pt_BR: - return XFA_GetLocaleFromBuffer(g_ptBR_Locale, sizeof(g_ptBR_Locale)); - case XFA_LANGID_nl_NL: - return XFA_GetLocaleFromBuffer(g_nlNL_Locale, sizeof(g_nlNL_Locale)); - case XFA_LANGID_ru_RU: - return XFA_GetLocaleFromBuffer(g_ruRU_Locale, sizeof(g_ruRU_Locale)); - case XFA_LANGID_en_US: - default: - return XFA_GetLocaleFromBuffer(g_enUS_Locale, sizeof(g_enUS_Locale)); - } -} - -IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( - const CFX_WideString& wsLocaleName) { - for (size_t i = 0; i < m_LocaleArray.size(); i++) { - IFX_Locale* pLocale = m_LocaleArray[i].get(); - if (pLocale->GetName() == wsLocaleName) - return pLocale; - } - if (wsLocaleName.GetLength() < 2) - return nullptr; - for (size_t i = 0; i < m_XMLLocaleArray.size(); i++) { - IFX_Locale* pLocale = m_XMLLocaleArray[i].get(); - if (pLocale->GetName() == wsLocaleName) - return pLocale; - } - uint16_t dwLangueID = XFA_GetLanguage(wsLocaleName); - std::unique_ptr pLocale(GetLocale(dwLangueID)); - IFX_Locale* pRetLocale = pLocale.get(); - if (pLocale) - m_XMLLocaleArray.push_back(std::move(pLocale)); - return pRetLocale; -} - -void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) { - m_pDefLocale = pLocale; -} - -CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { - if (!(m_dwLocaleFlags & 0x01)) { - m_wsConfigLocale.clear(); - if (pConfig) { - CXFA_Node* pChildfConfig = - pConfig->GetFirstChildByClass(XFA_Element::Acrobat); - if (!pChildfConfig) { - pChildfConfig = pConfig->GetFirstChildByClass(XFA_Element::Present); - } - CXFA_Node* pCommon = - pChildfConfig - ? pChildfConfig->GetFirstChildByClass(XFA_Element::Common) - : nullptr; - CXFA_Node* pLocale = - pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale) - : nullptr; - if (pLocale) { - pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, false); - } - } - m_dwLocaleFlags |= 0x01; - } - return m_wsConfigLocale.AsStringC(); -} - -static bool g_bProviderTimeZoneSet = false; - -CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - if (!g_bProviderTimeZoneSet) { - g_bProviderTimeZoneSet = true; - _tzset(); - } - m_tz.tzHour = (int8_t)(_timezone / 3600 * -1); - m_tz.tzMinute = (int8_t)((FXSYS_abs(_timezone) % 3600) / 60); -#else - if (!g_bProviderTimeZoneSet) { - g_bProviderTimeZoneSet = true; - tzset(); - } - m_tz.tzHour = (int8_t)(timezone / 3600 * -1); - m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); -#endif -} - -CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} - -void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE* tz) const { - *tz = m_tz; -} diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h deleted file mode 100644 index 3336d713e0..0000000000 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ /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 - -#ifndef XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ -#define XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ - -#include -#include - -#include "xfa/fgas/localization/fgas_datetime.h" -#include "xfa/fgas/localization/fgas_locale.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" - -class CXFA_Node; -class IFX_Locale; - -#define XFA_LANGID_zh_CN 0x0804 -#define XFA_LANGID_zh_TW 0x0404 -#define XFA_LANGID_zh_HK 0x0c04 -#define XFA_LANGID_ja_JP 0x0411 -#define XFA_LANGID_ko_KR 0x0412 -#define XFA_LANGID_en_US 0x0409 -#define XFA_LANGID_en_GB 0x0809 -#define XFA_LANGID_es_ES 0x0c0a -#define XFA_LANGID_es_LA 0x080a -#define XFA_LANGID_de_DE 0x0407 -#define XFA_LANGID_fr_FR 0x040c -#define XFA_LANGID_it_IT 0x0410 -#define XFA_LANGID_pt_BR 0x0416 -#define XFA_LANGID_nl_NL 0x0413 -#define XFA_LANGID_ru_RU 0x0419 - -class CXFA_LocaleMgr { - public: - CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); - ~CXFA_LocaleMgr(); - - uint16_t GetDefLocaleID() const; - IFX_Locale* GetDefLocale(); - IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName); - - void SetDefLocale(IFX_Locale* pLocale); - CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); - - private: - std::unique_ptr GetLocale(uint16_t lcid); - - std::vector> m_LocaleArray; - std::vector> m_XMLLocaleArray; - IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray. - CFX_WideString m_wsConfigLocale; - uint16_t m_dwDeflcid; - uint16_t m_dwLocaleFlags; -}; - -class CXFA_TimeZoneProvider { - public: - CXFA_TimeZoneProvider(); - ~CXFA_TimeZoneProvider(); - - void GetTimeZone(FX_TIMEZONE* tz) const; - - private: - FX_TIMEZONE m_tz; -}; - -#endif // XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp deleted file mode 100644 index 770b87ee14..0000000000 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ /dev/null @@ -1,982 +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/parser/xfa_localevalue.h" - -#include - -#include "core/fxcrt/fx_ext.h" -#include "third_party/base/ptr_util.h" -#include "third_party/base/stl_util.h" -#include "xfa/fgas/localization/cfx_formatstring.h" -#include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_utils.h" - -CXFA_LocaleValue::CXFA_LocaleValue() { - m_dwType = XFA_VT_NULL; - m_bValid = true; - m_pLocaleMgr = nullptr; -} -CXFA_LocaleValue::CXFA_LocaleValue(const CXFA_LocaleValue& value) { - m_dwType = XFA_VT_NULL; - m_bValid = true; - m_pLocaleMgr = nullptr; - *this = value; -} -CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, - CXFA_LocaleMgr* pLocaleMgr) { - m_dwType = dwType; - m_bValid = (m_dwType != XFA_VT_NULL); - m_pLocaleMgr = pLocaleMgr; -} -CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, - CXFA_LocaleMgr* pLocaleMgr) { - m_wsValue = wsValue; - m_dwType = dwType; - m_pLocaleMgr = pLocaleMgr; - m_bValid = ValidateCanonicalValue(wsValue, dwType); -} -CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale, - CXFA_LocaleMgr* pLocaleMgr) { - m_pLocaleMgr = pLocaleMgr; - m_bValid = true; - m_dwType = dwType; - m_bValid = ParsePatternValue(wsValue, wsFormat, pLocale); -} -CXFA_LocaleValue& CXFA_LocaleValue::operator=(const CXFA_LocaleValue& value) { - m_wsValue = value.m_wsValue; - m_dwType = value.m_dwType; - m_bValid = value.m_bValid; - m_pLocaleMgr = value.m_pLocaleMgr; - return *this; -} -CXFA_LocaleValue::~CXFA_LocaleValue() {} -static FX_LOCALECATEGORY XFA_ValugeCategory(FX_LOCALECATEGORY eCategory, - uint32_t dwValueType) { - if (eCategory == FX_LOCALECATEGORY_Unknown) { - switch (dwValueType) { - case XFA_VT_BOOLEAN: - case XFA_VT_INTEGER: - case XFA_VT_DECIMAL: - case XFA_VT_FLOAT: - return FX_LOCALECATEGORY_Num; - case XFA_VT_TEXT: - return FX_LOCALECATEGORY_Text; - case XFA_VT_DATE: - return FX_LOCALECATEGORY_Date; - case XFA_VT_TIME: - return FX_LOCALECATEGORY_Time; - case XFA_VT_DATETIME: - return FX_LOCALECATEGORY_DateTime; - } - } - return eCategory; -} - -bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, - IFX_Locale* pLocale, - CFX_WideString* pMatchFormat) { - CFX_WideString wsOutput; - IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); - if (pLocale) - m_pLocaleMgr->SetDefLocale(pLocale); - - auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); - std::vector wsPatterns; - pFormat->SplitFormatString(wsPattern, wsPatterns); - - bool bRet = false; - int32_t iCount = pdfium::CollectionSize(wsPatterns); - int32_t i = 0; - for (; i < iCount && !bRet; i++) { - CFX_WideString wsFormat = wsPatterns[i]; - FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); - eCategory = XFA_ValugeCategory(eCategory, m_dwType); - switch (eCategory) { - case FX_LOCALECATEGORY_Null: - bRet = pFormat->ParseNull(wsValue, wsFormat); - if (!bRet) { - bRet = wsValue.IsEmpty(); - } - break; - case FX_LOCALECATEGORY_Zero: - bRet = pFormat->ParseZero(wsValue, wsFormat); - if (!bRet) { - bRet = wsValue == L"0"; - } - break; - case FX_LOCALECATEGORY_Num: { - CFX_WideString fNum; - bRet = pFormat->ParseNum(wsValue, wsFormat, fNum); - if (!bRet) { - bRet = pFormat->FormatNum(wsValue, wsFormat, wsOutput); - } - break; - } - case FX_LOCALECATEGORY_Text: - bRet = pFormat->ParseText(wsValue, wsFormat, wsOutput); - wsOutput.clear(); - if (!bRet) { - bRet = pFormat->FormatText(wsValue, wsFormat, wsOutput); - } - break; - case FX_LOCALECATEGORY_Date: { - CFX_Unitime dt; - bRet = ValidateCanonicalDate(wsValue, &dt); - if (!bRet) { - bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date, - &dt); - if (!bRet) { - bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, - FX_DATETIMETYPE_Date); - } - } - break; - } - case FX_LOCALECATEGORY_Time: { - CFX_Unitime dt; - bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, - &dt); - if (!bRet) { - bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, - FX_DATETIMETYPE_Time); - } - break; - } - case FX_LOCALECATEGORY_DateTime: { - CFX_Unitime dt; - bRet = pFormat->ParseDateTime(wsValue, wsFormat, - FX_DATETIMETYPE_DateTime, &dt); - if (!bRet) { - bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, - FX_DATETIMETYPE_DateTime); - } - break; - } - default: - bRet = false; - break; - } - } - if (bRet && pMatchFormat) - *pMatchFormat = wsPatterns[i - 1]; - - if (pLocale) - m_pLocaleMgr->SetDefLocale(locale); - - return bRet; -} - -CFX_WideString CXFA_LocaleValue::GetValue() const { - return m_wsValue; -} -uint32_t CXFA_LocaleValue::GetType() const { - return m_dwType; -} -void CXFA_LocaleValue::SetValue(const CFX_WideString& wsValue, - uint32_t dwType) { - m_wsValue = wsValue; - m_dwType = dwType; -} -CFX_WideString CXFA_LocaleValue::GetText() const { - if (m_bValid && m_dwType == XFA_VT_TEXT) { - return m_wsValue; - } - return CFX_WideString(); -} -float CXFA_LocaleValue::GetNum() const { - if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || - m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { - int64_t nIntegral = 0; - uint32_t dwFractional = 0; - int32_t nExponent = 0; - int cc = 0; - bool bNegative = false, bExpSign = false; - const wchar_t* str = m_wsValue.c_str(); - int len = m_wsValue.GetLength(); - while (FXSYS_iswspace(str[cc]) && cc < len) { - cc++; - } - if (cc >= len) { - return 0; - } - if (str[0] == '+') { - cc++; - } else if (str[0] == '-') { - bNegative = true; - cc++; - } - int nIntegralLen = 0; - while (cc < len) { - if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) || - nIntegralLen > 17) { - break; - } - nIntegral = nIntegral * 10 + str[cc] - '0'; - cc++; - nIntegralLen++; - } - nIntegral = bNegative ? -nIntegral : nIntegral; - int scale = 0; - double fraction = 0.0; - if (cc < len && str[cc] == '.') { - cc++; - while (cc < len) { - fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0'); - scale++; - cc++; - if (scale == XFA_GetMaxFractionalScale() || - !FXSYS_isDecimalDigit(str[cc])) { - break; - } - } - dwFractional = (uint32_t)(fraction * 4294967296.0); - } - if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { - cc++; - if (cc < len) { - if (str[cc] == '+') { - cc++; - } else if (str[cc] == '-') { - bExpSign = true; - cc++; - } - } - while (cc < len) { - if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { - break; - } - nExponent = nExponent * 10 + str[cc] - '0'; - cc++; - } - nExponent = bExpSign ? -nExponent : nExponent; - } - float fValue = (float)(dwFractional / 4294967296.0); - fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue); - if (nExponent != 0) { - fValue *= FXSYS_pow(10, (float)nExponent); - } - return fValue; - } - return 0; -} -double CXFA_LocaleValue::GetDoubleNum() const { - if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || - m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { - int64_t nIntegral = 0; - uint32_t dwFractional = 0; - int32_t nExponent = 0; - int32_t cc = 0; - bool bNegative = false, bExpSign = false; - const wchar_t* str = m_wsValue.c_str(); - int len = m_wsValue.GetLength(); - while (FXSYS_iswspace(str[cc]) && cc < len) - cc++; - - if (cc >= len) - return 0; - if (str[0] == '+') { - cc++; - } else if (str[0] == '-') { - bNegative = true; - cc++; - } - - int32_t nIntegralLen = 0; - while (cc < len) { - if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) || - nIntegralLen > 17) { - break; - } - nIntegral = nIntegral * 10 + str[cc] - '0'; - cc++; - nIntegralLen++; - } - nIntegral = bNegative ? -nIntegral : nIntegral; - int32_t scale = 0; - double fraction = 0.0; - if (cc < len && str[cc] == '.') { - cc++; - while (cc < len) { - fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0'); - scale++; - cc++; - if (scale == XFA_GetMaxFractionalScale() || - !FXSYS_isDecimalDigit(str[cc])) { - break; - } - } - dwFractional = static_cast(fraction * 4294967296.0); - } - if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { - cc++; - if (cc < len) { - if (str[cc] == '+') { - cc++; - } else if (str[cc] == '-') { - bExpSign = true; - cc++; - } - } - while (cc < len) { - if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) - break; - - nExponent = nExponent * 10 + str[cc] - '0'; - cc++; - } - nExponent = bExpSign ? -nExponent : nExponent; - } - - double dValue = dwFractional / 4294967296.0; - dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); - if (nExponent != 0) - dValue *= FXSYS_pow(10, static_cast(nExponent)); - - return dValue; - } - return 0; -} - -CFX_Unitime CXFA_LocaleValue::GetDate() const { - if (m_bValid && m_dwType == XFA_VT_DATE) { - CFX_Unitime dt; - FX_DateFromCanonical(m_wsValue, &dt); - return dt; - } - return CFX_Unitime(); -} - -CFX_Unitime CXFA_LocaleValue::GetTime() const { - if (m_bValid && m_dwType == XFA_VT_TIME) { - ASSERT(m_pLocaleMgr); - - CFX_Unitime dt; - FX_TimeFromCanonical(m_wsValue.AsStringC(), &dt, - m_pLocaleMgr->GetDefLocale()); - return dt; - } - return CFX_Unitime(); -} - -CFX_Unitime CXFA_LocaleValue::GetDateTime() const { - if (m_bValid && m_dwType == XFA_VT_DATETIME) { - int32_t index = m_wsValue.Find('T'); - CFX_Unitime dt; - FX_DateFromCanonical(m_wsValue.Left(index), &dt); - ASSERT(m_pLocaleMgr); - FX_TimeFromCanonical( - m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsStringC(), &dt, - m_pLocaleMgr->GetDefLocale()); - return dt; - } - return CFX_Unitime(); -} - -bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText) { - m_dwType = XFA_VT_TEXT; - m_wsValue = wsText; - return true; -} - -bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale) { - m_dwType = XFA_VT_TEXT; - return m_bValid = ParsePatternValue(wsText, wsFormat, pLocale); -} - -bool CXFA_LocaleValue::SetNum(float fNum) { - m_dwType = XFA_VT_FLOAT; - m_wsValue.Format(L"%.8g", static_cast(fNum)); - return true; -} - -bool CXFA_LocaleValue::SetNum(const CFX_WideString& wsNum, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale) { - m_dwType = XFA_VT_FLOAT; - return m_bValid = ParsePatternValue(wsNum, wsFormat, pLocale); -} - -bool CXFA_LocaleValue::SetDate(const CFX_Unitime& d) { - m_dwType = XFA_VT_DATE; - m_wsValue.Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(), d.GetDay()); - return true; -} - -bool CXFA_LocaleValue::SetDate(const CFX_WideString& wsDate, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale) { - m_dwType = XFA_VT_DATE; - return m_bValid = ParsePatternValue(wsDate, wsFormat, pLocale); -} - -bool CXFA_LocaleValue::SetTime(const CFX_Unitime& t) { - m_dwType = XFA_VT_TIME; - m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(), - t.GetSecond()); - if (t.GetMillisecond() > 0) { - CFX_WideString wsTemp; - wsTemp.Format(L"%:03d", t.GetMillisecond()); - m_wsValue += wsTemp; - } - return true; -} - -bool CXFA_LocaleValue::SetTime(const CFX_WideString& wsTime, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale) { - m_dwType = XFA_VT_TIME; - return m_bValid = ParsePatternValue(wsTime, wsFormat, pLocale); -} - -bool CXFA_LocaleValue::SetDateTime(const CFX_Unitime& dt) { - m_dwType = XFA_VT_DATETIME; - m_wsValue.Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(), - dt.GetMonth(), dt.GetDay(), dt.GetHour(), dt.GetMinute(), - dt.GetSecond()); - if (dt.GetMillisecond() > 0) { - CFX_WideString wsTemp; - wsTemp.Format(L"%:03d", dt.GetMillisecond()); - m_wsValue += wsTemp; - } - return true; -} - -bool CXFA_LocaleValue::SetDateTime(const CFX_WideString& wsDateTime, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale) { - m_dwType = XFA_VT_DATETIME; - return m_bValid = ParsePatternValue(wsDateTime, wsFormat, pLocale); -} - -bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale, - XFA_VALUEPICTURE eValueType) const { - auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); - std::vector wsPatterns; - pFormat->SplitFormatString(wsFormat, wsPatterns); - wsResult.clear(); - int32_t iCount = pdfium::CollectionSize(wsPatterns); - for (int32_t i = 0; i < iCount; i++) { - if (FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType)) - return true; - } - return false; -} - -bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale, - XFA_VALUEPICTURE eValueType) const { - IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); - if (pLocale) - m_pLocaleMgr->SetDefLocale(pLocale); - - wsResult.clear(); - bool bRet = false; - auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); - FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); - eCategory = XFA_ValugeCategory(eCategory, m_dwType); - switch (eCategory) { - case FX_LOCALECATEGORY_Null: - if (m_wsValue.IsEmpty()) { - bRet = pFormat->FormatNull(wsFormat, wsResult); - } - break; - case FX_LOCALECATEGORY_Zero: - if (m_wsValue == L"0") { - bRet = pFormat->FormatZero(wsFormat, wsResult); - } - break; - case FX_LOCALECATEGORY_Num: - bRet = pFormat->FormatNum(m_wsValue, wsFormat, wsResult); - break; - case FX_LOCALECATEGORY_Text: - bRet = pFormat->FormatText(m_wsValue, wsFormat, wsResult); - break; - case FX_LOCALECATEGORY_Date: - bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult, - FX_DATETIMETYPE_Date); - break; - case FX_LOCALECATEGORY_Time: - bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult, - FX_DATETIMETYPE_Time); - break; - case FX_LOCALECATEGORY_DateTime: - bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult, - FX_DATETIMETYPE_DateTime); - break; - default: - wsResult = m_wsValue; - bRet = true; - } - if (!bRet && (eCategory != FX_LOCALECATEGORY_Num || - eValueType != XFA_VALUEPICTURE_Display)) { - wsResult = m_wsValue; - } - if (pLocale) - m_pLocaleMgr->SetDefLocale(locale); - - return bRet; -} - -static bool XFA_ValueSplitDateTime(const CFX_WideString& wsDateTime, - CFX_WideString& wsDate, - CFX_WideString& wsTime) { - wsDate = L""; - wsTime = L""; - if (wsDateTime.IsEmpty()) { - return false; - } - int nSplitIndex = -1; - nSplitIndex = wsDateTime.Find('T'); - if (nSplitIndex < 0) { - nSplitIndex = wsDateTime.Find(' '); - } - if (nSplitIndex < 0) { - return false; - } - wsDate = wsDateTime.Left(nSplitIndex); - wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1); - return true; -} -bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, - uint32_t dwVType) { - if (wsValue.IsEmpty()) { - return true; - } - CFX_Unitime dt; - switch (dwVType) { - case XFA_VT_DATE: { - if (ValidateCanonicalDate(wsValue, &dt)) - return true; - - CFX_WideString wsDate, wsTime; - if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) && - ValidateCanonicalDate(wsDate, &dt)) { - return true; - } - return false; - } - case XFA_VT_TIME: { - if (ValidateCanonicalTime(wsValue)) - return true; - - CFX_WideString wsDate, wsTime; - if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) && - ValidateCanonicalTime(wsTime)) { - return true; - } - return false; - } - case XFA_VT_DATETIME: { - CFX_WideString wsDate, wsTime; - if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) && - ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime)) { - return true; - } - } break; - } - return true; -} -bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, - CFX_Unitime* unDate) { - const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - const uint16_t wCountY = 4, wCountM = 2, wCountD = 2; - int nLen = wsDate.GetLength(); - if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { - return false; - } - const bool bSymbol = wsDate.Find(0x2D) != -1; - uint16_t wYear = 0; - uint16_t wMonth = 0; - uint16_t wDay = 0; - const wchar_t* pDate = wsDate.c_str(); - int nIndex = 0, nStart = 0; - while (pDate[nIndex] != '\0' && nIndex < wCountY) { - if (!FXSYS_isDecimalDigit(pDate[nIndex])) { - return false; - } - wYear = (pDate[nIndex] - '0') + wYear * 10; - nIndex++; - } - if (bSymbol) { - if (pDate[nIndex] != 0x2D) { - return false; - } - nIndex++; - } - nStart = nIndex; - while (pDate[nIndex] != '\0' && nIndex - nStart < wCountM && nIndex < nLen) { - if (!FXSYS_isDecimalDigit(pDate[nIndex])) { - return false; - } - wMonth = (pDate[nIndex] - '0') + wMonth * 10; - nIndex++; - } - if (bSymbol) { - if (pDate[nIndex] != 0x2D) { - return false; - } - nIndex++; - } - nStart = nIndex; - while (pDate[nIndex] != '\0' && nIndex - nStart < wCountD && nIndex < nLen) { - if (!FXSYS_isDecimalDigit(pDate[nIndex])) { - return false; - } - wDay = (pDate[nIndex] - '0') + wDay * 10; - nIndex++; - } - if (nIndex != nLen) { - return false; - } - if (wYear < 1900 || wYear > 2029) { - return false; - } - if (wMonth < 1 || wMonth > 12) { - if (wMonth == 0 && nLen == wCountY) { - return true; - } - return false; - } - if (wDay < 1) { - if (wDay == 0 && (nLen == wCountY + wCountM)) { - return true; - } - return false; - } - if (wMonth == 2) { - if (wYear % 400 == 0 || (wYear % 100 != 0 && wYear % 4 == 0)) { - if (wDay > 29) { - return false; - } - } else { - if (wDay > 28) { - return false; - } - } - } else if (wDay > LastDay[wMonth - 1]) { - return false; - } - - unDate->SetDate(wYear, static_cast(wMonth), - static_cast(wDay)); - return true; -} - -bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { - int nLen = wsTime.GetLength(); - if (nLen < 2) - return false; - const uint16_t wCountH = 2; - const uint16_t wCountM = 2; - const uint16_t wCountS = 2; - const uint16_t wCountF = 3; - const bool bSymbol = wsTime.Find(':') != -1; - uint16_t wHour = 0; - uint16_t wMinute = 0; - uint16_t wSecond = 0; - uint16_t wFraction = 0; - const wchar_t* pTime = wsTime.c_str(); - int nIndex = 0; - int nStart = 0; - while (nIndex - nStart < wCountH && pTime[nIndex]) { - if (!FXSYS_isDecimalDigit(pTime[nIndex])) - return false; - wHour = pTime[nIndex] - '0' + wHour * 10; - nIndex++; - } - if (bSymbol) { - if (nIndex < nLen && pTime[nIndex] != ':') - return false; - nIndex++; - } - nStart = nIndex; - while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { - if (!FXSYS_isDecimalDigit(pTime[nIndex])) - return false; - wMinute = pTime[nIndex] - '0' + wMinute * 10; - nIndex++; - } - if (bSymbol) { - if (nIndex < nLen && pTime[nIndex] != ':') - return false; - nIndex++; - } - nStart = nIndex; - while (nIndex - nStart < wCountS && nIndex < nLen && pTime[nIndex]) { - if (!FXSYS_isDecimalDigit(pTime[nIndex])) - return false; - wSecond = pTime[nIndex] - '0' + wSecond * 10; - nIndex++; - } - if (wsTime.Find('.') > 0) { - if (pTime[nIndex] != '.') - return false; - nIndex++; - nStart = nIndex; - while (nIndex - nStart < wCountF && nIndex < nLen && pTime[nIndex]) { - if (!FXSYS_isDecimalDigit(pTime[nIndex])) - return false; - wFraction = pTime[nIndex] - '0' + wFraction * 10; - nIndex++; - } - } - if (nIndex < nLen) { - if (pTime[nIndex] == 'Z') { - nIndex++; - } else if (pTime[nIndex] == '-' || pTime[nIndex] == '+') { - int16_t nOffsetH = 0; - int16_t nOffsetM = 0; - nIndex++; - nStart = nIndex; - while (nIndex - nStart < wCountH && nIndex < nLen && pTime[nIndex]) { - if (!FXSYS_isDecimalDigit(pTime[nIndex])) - return false; - nOffsetH = pTime[nIndex] - '0' + nOffsetH * 10; - nIndex++; - } - if (bSymbol) { - if (nIndex < nLen && pTime[nIndex] != ':') - return false; - nIndex++; - } - nStart = nIndex; - while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { - if (!FXSYS_isDecimalDigit(pTime[nIndex])) - return false; - nOffsetM = pTime[nIndex] - '0' + nOffsetM * 10; - nIndex++; - } - if (nOffsetH > 12 || nOffsetM >= 60) - return false; - } - } - return nIndex == nLen && wHour < 24 && wMinute < 60 && wSecond < 60 && - wFraction <= 999; -} - -bool CXFA_LocaleValue::ValidateCanonicalDateTime( - const CFX_WideString& wsDateTime) { - CFX_WideString wsDate, wsTime; - if (wsDateTime.IsEmpty()) - return false; - - int nSplitIndex = -1; - nSplitIndex = wsDateTime.Find('T'); - if (nSplitIndex < 0) - nSplitIndex = wsDateTime.Find(' '); - if (nSplitIndex < 0) - return false; - - wsDate = wsDateTime.Left(nSplitIndex); - wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1); - CFX_Unitime dt; - return ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime); -} - -bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, - IFX_Locale* pLocale) { - IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); - if (pLocale) - m_pLocaleMgr->SetDefLocale(pLocale); - - auto pFormat = pdfium::MakeUnique(m_pLocaleMgr); - std::vector wsPatterns; - pFormat->SplitFormatString(wsPattern, wsPatterns); - bool bRet = false; - int32_t iCount = pdfium::CollectionSize(wsPatterns); - for (int32_t i = 0; i < iCount && !bRet; i++) { - CFX_WideString wsFormat = wsPatterns[i]; - FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); - eCategory = XFA_ValugeCategory(eCategory, m_dwType); - switch (eCategory) { - case FX_LOCALECATEGORY_Null: - bRet = pFormat->ParseNull(wsValue, wsFormat); - if (bRet) { - m_wsValue.clear(); - } - break; - case FX_LOCALECATEGORY_Zero: - bRet = pFormat->ParseZero(wsValue, wsFormat); - if (bRet) - m_wsValue = L"0"; - break; - case FX_LOCALECATEGORY_Num: { - CFX_WideString fNum; - bRet = pFormat->ParseNum(wsValue, wsFormat, fNum); - if (bRet) { - m_wsValue = fNum; - } - break; - } - case FX_LOCALECATEGORY_Text: - bRet = pFormat->ParseText(wsValue, wsFormat, m_wsValue); - break; - case FX_LOCALECATEGORY_Date: { - CFX_Unitime dt; - bRet = ValidateCanonicalDate(wsValue, &dt); - if (!bRet) { - bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date, - &dt); - } - if (bRet) - SetDate(dt); - break; - } - case FX_LOCALECATEGORY_Time: { - CFX_Unitime dt; - bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, - &dt); - if (bRet) - SetTime(dt); - break; - } - case FX_LOCALECATEGORY_DateTime: { - CFX_Unitime dt; - bRet = pFormat->ParseDateTime(wsValue, wsFormat, - FX_DATETIMETYPE_DateTime, &dt); - if (bRet) - SetDateTime(dt); - break; - } - default: - m_wsValue = wsValue; - bRet = true; - break; - } - } - if (!bRet) - m_wsValue = wsValue; - - if (pLocale) - m_pLocaleMgr->SetDefLocale(locale); - - return bRet; -} - -void CXFA_LocaleValue::GetNumbericFormat(CFX_WideString& wsFormat, - int32_t nIntLen, - int32_t nDecLen, - bool bSign) { - ASSERT(wsFormat.IsEmpty()); - ASSERT(nIntLen >= -1 && nDecLen >= -1); - int32_t nTotalLen = (nIntLen >= 0 ? nIntLen : 2) + (bSign ? 1 : 0) + - (nDecLen >= 0 ? nDecLen : 2) + (nDecLen == 0 ? 0 : 1); - wchar_t* lpBuf = wsFormat.GetBuffer(nTotalLen); - int32_t nPos = 0; - if (bSign) { - lpBuf[nPos++] = L's'; - } - if (nIntLen == -1) { - lpBuf[nPos++] = L'z'; - lpBuf[nPos++] = L'*'; - } else { - while (nIntLen) { - lpBuf[nPos++] = L'z'; - nIntLen--; - } - } - if (nDecLen != 0) { - lpBuf[nPos++] = L'.'; - } - if (nDecLen == -1) { - lpBuf[nPos++] = L'z'; - lpBuf[nPos++] = L'*'; - } else { - while (nDecLen) { - lpBuf[nPos++] = L'z'; - nDecLen--; - } - } - wsFormat.ReleaseBuffer(nTotalLen); -} -bool CXFA_LocaleValue::ValidateNumericTemp(CFX_WideString& wsNumeric, - CFX_WideString& wsFormat, - IFX_Locale* pLocale, - int32_t* pos) { - if (wsFormat.IsEmpty() || wsNumeric.IsEmpty()) { - return true; - } - const wchar_t* pNum = wsNumeric.c_str(); - const wchar_t* pFmt = wsFormat.c_str(); - int32_t n = 0, nf = 0; - wchar_t c = pNum[n]; - wchar_t cf = pFmt[nf]; - if (cf == L's') { - if (c == L'-' || c == L'+') { - ++n; - } - ++nf; - } - bool bLimit = true; - int32_t nCount = wsNumeric.GetLength(); - int32_t nCountFmt = wsFormat.GetLength(); - while (n < nCount && (bLimit ? nf < nCountFmt : true) && - FXSYS_isDecimalDigit(c = pNum[n])) { - if (bLimit == true) { - if ((cf = pFmt[nf]) == L'*') { - bLimit = false; - } else if (cf == L'z') { - nf++; - } else { - return false; - } - } - n++; - } - if (n == nCount) { - return true; - } - if (nf == nCountFmt) { - return false; - } - while (nf < nCountFmt && (cf = pFmt[nf]) != L'.') { - ASSERT(cf == L'z' || cf == L'*'); - ++nf; - } - CFX_WideString wsDecimalSymbol; - if (pLocale) { - pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDecimalSymbol); - } else { - wsDecimalSymbol = CFX_WideString(L'.'); - } - if (pFmt[nf] != L'.') { - return false; - } - if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.') { - return false; - } - ++nf; - ++n; - bLimit = true; - while (n < nCount && (bLimit ? nf < nCountFmt : true) && - FXSYS_isDecimalDigit(c = pNum[n])) { - if (bLimit == true) { - if ((cf = pFmt[nf]) == L'*') { - bLimit = false; - } else if (cf == L'z') { - nf++; - } else { - return false; - } - } - n++; - } - return n == nCount; -} diff --git a/xfa/fxfa/parser/xfa_localevalue.h b/xfa/fxfa/parser/xfa_localevalue.h deleted file mode 100644 index dfe758d4a9..0000000000 --- a/xfa/fxfa/parser/xfa_localevalue.h +++ /dev/null @@ -1,112 +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 - -#ifndef XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ -#define XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ - -#include "core/fxcrt/fx_string.h" -#include "core/fxcrt/fx_system.h" -#include "xfa/fxfa/parser/cxfa_widgetdata.h" - -class IFX_Locale; -class CFX_Unitime; -class CXFA_LocaleMgr; - -#define XFA_VT_NULL 0 -#define XFA_VT_BOOLEAN 1 -#define XFA_VT_INTEGER 2 -#define XFA_VT_DECIMAL 4 -#define XFA_VT_FLOAT 8 -#define XFA_VT_TEXT 16 -#define XFA_VT_DATE 32 -#define XFA_VT_TIME 64 -#define XFA_VT_DATETIME 128 - -class CXFA_LocaleValue { - public: - CXFA_LocaleValue(); - CXFA_LocaleValue(const CXFA_LocaleValue& value); - CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr); - CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, - CXFA_LocaleMgr* pLocaleMgr); - CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale, - CXFA_LocaleMgr* pLocaleMgr); - ~CXFA_LocaleValue(); - CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); - - bool ValidateValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, - IFX_Locale* pLocale, - CFX_WideString* pMatchFormat = nullptr); - bool FormatPatterns(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale, - XFA_VALUEPICTURE eValueType) const; - bool FormatSinglePattern(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale, - XFA_VALUEPICTURE eValueType) const; - bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType); - bool ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime* unDate); - bool ValidateCanonicalTime(const CFX_WideString& wsTime); - bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime); - void GetNumbericFormat(CFX_WideString& wsFormat, - int32_t nIntLen, - int32_t nDecLen, - bool bSign = true); - bool ValidateNumericTemp(CFX_WideString& wsNumeric, - CFX_WideString& wsFormat, - IFX_Locale* pLocale = nullptr, - int32_t* pos = nullptr); - - CFX_WideString GetValue() const; - uint32_t GetType() const; - void SetValue(const CFX_WideString& wsValue, uint32_t dwType); - CFX_WideString GetText() const; - float GetNum() const; - double GetDoubleNum() const; - CFX_Unitime GetDate() const; - CFX_Unitime GetTime() const; - CFX_Unitime GetDateTime() const; - bool SetText(const CFX_WideString& wsText); - bool SetText(const CFX_WideString& wsText, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale); - bool SetNum(float fNum); - bool SetNum(const CFX_WideString& wsNum, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale); - bool SetDate(const CFX_Unitime& d); - bool SetDate(const CFX_WideString& wsDate, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale); - bool SetTime(const CFX_Unitime& t); - bool SetTime(const CFX_WideString& wsTime, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale); - bool SetDateTime(const CFX_Unitime& dt); - bool SetDateTime(const CFX_WideString& wsDateTime, - const CFX_WideString& wsFormat, - IFX_Locale* pLocale); - bool IsNull() const { return m_dwType == XFA_VT_NULL; } - bool IsEmpty() const { return m_wsValue.IsEmpty(); } - bool IsValid() const { return m_bValid; } - - private: - bool ParsePatternValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, - IFX_Locale* pLocale); - CXFA_LocaleMgr* m_pLocaleMgr; - CFX_WideString m_wsValue; - uint32_t m_dwType; - bool m_bValid; -}; - -#endif // XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 5216d0cdd5..fd5728e5f6 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -9,10 +9,10 @@ #include "core/fxcrt/fx_ext.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_object.h" namespace { -- cgit v1.2.3