From 5fe712cb6c605e597f65f6b4cd0afa3213234639 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Nov 2017 20:59:30 +0000 Subject: Rename CXFA_Para to CXFA_ParaData This CL renames CXFA_Para to CXFA_ParaData to show it is part of the data hierarchy. Change-Id: I71f58c87416b17d1e59252ca374aad13935fc430 Reviewed-on: https://pdfium-review.googlesource.com/17989 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- BUILD.gn | 4 +-- xfa/fxfa/cxfa_ffcheckbutton.cpp | 6 ++-- xfa/fxfa/cxfa_ffcombobox.cpp | 8 ++--- xfa/fxfa/cxfa_ffdatetimeedit.cpp | 8 ++--- xfa/fxfa/cxfa_ffimage.cpp | 6 ++-- xfa/fxfa/cxfa_ffimageedit.cpp | 6 ++-- xfa/fxfa/cxfa_fflistbox.cpp | 6 ++-- xfa/fxfa/cxfa_fftextedit.cpp | 8 ++--- xfa/fxfa/cxfa_fwltheme.cpp | 12 ++++---- xfa/fxfa/cxfa_textlayout.cpp | 34 ++++++++++----------- xfa/fxfa/cxfa_textparser.cpp | 28 +++++++++-------- xfa/fxfa/cxfa_textprovider.cpp | 6 ++-- xfa/fxfa/cxfa_textprovider.h | 4 +-- xfa/fxfa/cxfa_widgetacc.cpp | 18 +++++------ xfa/fxfa/parser/cxfa_para.cpp | 60 ------------------------------------- xfa/fxfa/parser/cxfa_para.h | 29 ------------------ xfa/fxfa/parser/cxfa_paradata.cpp | 60 +++++++++++++++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_paradata.h | 29 ++++++++++++++++++ xfa/fxfa/parser/cxfa_widgetdata.cpp | 5 ++-- xfa/fxfa/parser/cxfa_widgetdata.h | 4 +-- 20 files changed, 172 insertions(+), 169 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_para.cpp delete mode 100644 xfa/fxfa/parser/cxfa_para.h create mode 100644 xfa/fxfa/parser/cxfa_paradata.cpp create mode 100644 xfa/fxfa/parser/cxfa_paradata.h diff --git a/BUILD.gn b/BUILD.gn index dee6505cdc..1e45ef301b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1860,8 +1860,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_object.h", "xfa/fxfa/parser/cxfa_occurdata.cpp", "xfa/fxfa/parser/cxfa_occurdata.h", - "xfa/fxfa/parser/cxfa_para.cpp", - "xfa/fxfa/parser/cxfa_para.h", + "xfa/fxfa/parser/cxfa_paradata.cpp", + "xfa/fxfa/parser/cxfa_paradata.h", "xfa/fxfa/parser/cxfa_rectangle.h", "xfa/fxfa/parser/cxfa_script.cpp", "xfa/fxfa/parser/cxfa_script.h", diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index e048598947..ae73ba43fe 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -115,9 +115,9 @@ bool CXFA_FFCheckButton::PerformLayout() { int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left; int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top; - if (CXFA_Para para = m_pDataAcc->GetPara()) { - iHorzAlign = para.GetHorizontalAlign(); - iVertAlign = para.GetVerticalAlign(); + if (CXFA_ParaData paraData = m_pDataAcc->GetParaData()) { + iHorzAlign = paraData.GetHorizontalAlign(); + iVertAlign = paraData.GetVerticalAlign(); } m_rtUI = rtWidget; diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index ca5645f8e2..f72e31226d 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -145,12 +145,12 @@ void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) { } uint32_t CXFA_FFComboBox::GetAlignment() { - CXFA_Para para = m_pDataAcc->GetPara(); - if (!para) + CXFA_ParaData paraData = m_pDataAcc->GetParaData(); + if (!paraData) return 0; uint32_t dwExtendedStyle = 0; - switch (para.GetHorizontalAlign()) { + switch (paraData.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: dwExtendedStyle |= FWL_STYLEEXT_CMB_EditHCenter | FWL_STYLEEXT_CMB_ListItemCenterAlign; @@ -170,7 +170,7 @@ uint32_t CXFA_FFComboBox::GetAlignment() { break; } - switch (para.GetVerticalAlign()) { + switch (paraData.GetVerticalAlign()) { case XFA_ATTRIBUTEENUM_Middle: dwExtendedStyle |= FWL_STYLEEXT_CMB_EditVCenter; break; diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index 5ed1690e30..c2ebb91bc9 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -95,12 +95,12 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() { } uint32_t CXFA_FFDateTimeEdit::GetAlignment() { - CXFA_Para para = m_pDataAcc->GetPara(); - if (!para) + CXFA_ParaData paraData = m_pDataAcc->GetParaData(); + if (!paraData) return 0; uint32_t dwExtendedStyle = 0; - switch (para.GetHorizontalAlign()) { + switch (paraData.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter; break; @@ -118,7 +118,7 @@ uint32_t CXFA_FFDateTimeEdit::GetAlignment() { break; } - switch (para.GetVerticalAlign()) { + switch (paraData.GetVerticalAlign()) { case XFA_ATTRIBUTEENUM_Middle: dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter; break; diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index f385d7ba01..f148ea12b4 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -54,9 +54,9 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left; int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top; - if (CXFA_Para para = m_pDataAcc->GetPara()) { - iHorzAlign = para.GetHorizontalAlign(); - iVertAlign = para.GetVerticalAlign(); + if (CXFA_ParaData paraData = m_pDataAcc->GetParaData()) { + iHorzAlign = paraData.GetHorizontalAlign(); + iVertAlign = paraData.GetVerticalAlign(); } CXFA_Value value = m_pDataAcc->GetFormValue(); diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 0a6338aff6..5140393b6e 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -70,9 +70,9 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect(); int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left; int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top; - if (CXFA_Para para = m_pDataAcc->GetPara()) { - iHorzAlign = para.GetHorizontalAlign(); - iVertAlign = para.GetVerticalAlign(); + if (CXFA_ParaData paraData = m_pDataAcc->GetParaData()) { + iHorzAlign = paraData.GetHorizontalAlign(); + iVertAlign = paraData.GetVerticalAlign(); } int32_t iAspect = XFA_ATTRIBUTEENUM_Fit; diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index 1fb66706d7..50bd29161f 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -104,12 +104,12 @@ bool CXFA_FFListBox::IsDataChanged() { } uint32_t CXFA_FFListBox::GetAlignment() { - CXFA_Para para = m_pDataAcc->GetPara(); - if (!para) + CXFA_ParaData paraData = m_pDataAcc->GetParaData(); + if (!paraData) return 0; uint32_t dwExtendedStyle = 0; - switch (para.GetHorizontalAlign()) { + switch (paraData.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: dwExtendedStyle |= FWL_STYLEEXT_LTB_CenterAlign; break; diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index dbfb52e085..61f48d7f54 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -215,12 +215,12 @@ bool CXFA_FFTextEdit::IsDataChanged() { } uint32_t CXFA_FFTextEdit::GetAlignment() { - CXFA_Para para = m_pDataAcc->GetPara(); - if (!para) + CXFA_ParaData paraData = m_pDataAcc->GetParaData(); + if (!paraData) return 0; uint32_t dwExtendedStyle = 0; - switch (para.GetHorizontalAlign()) { + switch (paraData.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter; break; @@ -238,7 +238,7 @@ uint32_t CXFA_FFTextEdit::GetAlignment() { break; } - switch (para.GetVerticalAlign()) { + switch (paraData.GetVerticalAlign()) { case XFA_ATTRIBUTEENUM_Middle: dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter; break; diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index f27b5ddef5..61c4e25f1d 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp @@ -154,10 +154,10 @@ CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const { CXFA_LayoutItem* pItem = pWidget; CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); rect = pWidgetAcc->GetUIMargin(); - if (CXFA_Para para = pWidgetAcc->GetPara()) { - rect.left += para.GetMarginLeft(); + if (CXFA_ParaData paraData = pWidgetAcc->GetParaData()) { + rect.left += paraData.GetMarginLeft(); if (pWidgetAcc->IsMultiLine()) - rect.width += para.GetMarginRight(); + rect.width += paraData.GetMarginRight(); } if (!pItem->GetPrev()) { if (pItem->GetNext()) @@ -212,9 +212,9 @@ CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const { CFX_SizeF sizeAboveBelow; if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); - if (CXFA_Para para = pWidgetAcc->GetPara()) { - sizeAboveBelow.width = para.GetSpaceAbove(); - sizeAboveBelow.height = para.GetSpaceBelow(); + if (CXFA_ParaData paraData = pWidgetAcc->GetParaData()) { + sizeAboveBelow.width = paraData.GetSpaceAbove(); + sizeAboveBelow.height = paraData.GetSpaceBelow(); } } return sizeAboveBelow; diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index 309c13a56a..331ea18798 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -29,7 +29,7 @@ #include "xfa/fxfa/cxfa_textuserdata.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_para.h" +#include "xfa/fxfa/parser/cxfa_paradata.h" #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 @@ -102,12 +102,12 @@ std::unique_ptr CXFA_TextLayout::CreateBreak(bool bDefault) { } void CXFA_TextLayout::InitBreak(float fLineWidth) { - CXFA_Para para = m_pTextProvider->GetParaNode(); + CXFA_ParaData paraData = m_pTextProvider->GetParaData(); float fStart = 0; float fStartPos = 0; - if (para) { + if (paraData) { CFX_RTFLineAlignment iAlign = CFX_RTFLineAlignment::Left; - switch (para.GetHorizontalAlign()) { + switch (paraData.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: iAlign = CFX_RTFLineAlignment::Center; break; @@ -123,18 +123,18 @@ void CXFA_TextLayout::InitBreak(float fLineWidth) { } m_pBreak->SetAlignment(iAlign); - fStart = para.GetMarginLeft(); + fStart = paraData.GetMarginLeft(); if (m_pTextProvider->IsCheckButtonAndAutoWidth()) { if (iAlign != CFX_RTFLineAlignment::Left) - fLineWidth -= para.GetMarginRight(); + fLineWidth -= paraData.GetMarginRight(); } else { - fLineWidth -= para.GetMarginRight(); + fLineWidth -= paraData.GetMarginRight(); } if (fLineWidth < 0) fLineWidth = fStart; fStartPos = fStart; - float fIndent = para.GetTextIndent(); + float fIndent = paraData.GetTextIndent(); if (fIndent > 0) fStartPos += fIndent; } @@ -661,14 +661,14 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, bool bSavePieces) { InitBreak(szText.width); - CXFA_Para para = m_pTextProvider->GetParaNode(); + CXFA_ParaData paraData = m_pTextProvider->GetParaData(); float fSpaceAbove = 0; - if (para) { - fSpaceAbove = para.GetSpaceAbove(); + if (paraData) { + fSpaceAbove = paraData.GetSpaceAbove(); if (fSpaceAbove < 0.1f) { fSpaceAbove = 0; } - int32_t verAlign = para.GetVerticalAlign(); + int32_t verAlign = paraData.GetVerticalAlign(); switch (verAlign) { case XFA_ATTRIBUTEENUM_Top: case XFA_ATTRIBUTEENUM_Middle: @@ -1107,14 +1107,14 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, if (dwStatus == CFX_BreakType::Paragraph) { m_pBreak->Reset(); if (!pStyle && bEndBreak) { - CXFA_Para para = m_pTextProvider->GetParaNode(); - if (para) { - float fStartPos = para.GetMarginLeft(); - float fIndent = para.GetTextIndent(); + CXFA_ParaData paraData = m_pTextProvider->GetParaData(); + if (paraData) { + float fStartPos = paraData.GetMarginLeft(); + float fIndent = paraData.GetTextIndent(); if (fIndent > 0) fStartPos += fIndent; - float fSpaceBelow = para.GetSpaceBelow(); + float fSpaceBelow = paraData.GetSpaceBelow(); if (fSpaceBelow < 0.1f) fSpaceBelow = 0; diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index ea5f62e81a..a95350da98 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp @@ -90,18 +90,18 @@ std::unique_ptr CXFA_TextParser::LoadDefaultSheetStyle() { RetainPtr CXFA_TextParser::CreateRootStyle( CXFA_TextProvider* pTextProvider) { - CXFA_Para para = pTextProvider->GetParaNode(); + CXFA_ParaData paraData = pTextProvider->GetParaData(); auto pStyle = m_pSelector->CreateComputedStyle(nullptr); float fLineHeight = 0; float fFontSize = 10; - if (para) { - fLineHeight = para.GetLineHeight(); + if (paraData) { + fLineHeight = paraData.GetLineHeight(); CFX_CSSLength indent; - indent.Set(CFX_CSSLengthUnit::Point, para.GetTextIndent()); + indent.Set(CFX_CSSLengthUnit::Point, paraData.GetTextIndent()); pStyle->SetTextIndent(indent); CFX_CSSTextAlign hAlign = CFX_CSSTextAlign::Left; - switch (para.GetHorizontalAlign()) { + switch (paraData.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: hAlign = CFX_CSSTextAlign::Center; break; @@ -117,10 +117,12 @@ RetainPtr CXFA_TextParser::CreateRootStyle( } pStyle->SetTextAlign(hAlign); CFX_CSSRect rtMarginWidth; - rtMarginWidth.left.Set(CFX_CSSLengthUnit::Point, para.GetMarginLeft()); - rtMarginWidth.top.Set(CFX_CSSLengthUnit::Point, para.GetSpaceAbove()); - rtMarginWidth.right.Set(CFX_CSSLengthUnit::Point, para.GetMarginRight()); - rtMarginWidth.bottom.Set(CFX_CSSLengthUnit::Point, para.GetSpaceBelow()); + rtMarginWidth.left.Set(CFX_CSSLengthUnit::Point, paraData.GetMarginLeft()); + rtMarginWidth.top.Set(CFX_CSSLengthUnit::Point, paraData.GetSpaceAbove()); + rtMarginWidth.right.Set(CFX_CSSLengthUnit::Point, + paraData.GetMarginRight()); + rtMarginWidth.bottom.Set(CFX_CSSLengthUnit::Point, + paraData.GetSpaceBelow()); pStyle->SetMarginWidth(rtMarginWidth); } @@ -289,8 +291,8 @@ std::unique_ptr CXFA_TextParser::ParseTagInfo( } int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const { - CXFA_Para para = pTextProvider->GetParaNode(); - return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; + CXFA_ParaData paraData = pTextProvider->GetParaData(); + return paraData ? paraData.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; } float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const { @@ -465,8 +467,8 @@ float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, float fLineHeight = 0; if (pStyle) fLineHeight = pStyle->GetLineHeight(); - else if (CXFA_Para para = pTextProvider->GetParaNode()) - fLineHeight = para.GetLineHeight(); + else if (CXFA_ParaData paraData = pTextProvider->GetParaData()) + fLineHeight = paraData.GetLineHeight(); if (bFirst) { float fFontSize = GetFontSize(pTextProvider, pStyle); diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index 6529c01b6c..0da24229d9 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -111,13 +111,13 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { return nullptr; } -CXFA_Para CXFA_TextProvider::GetParaNode() { +CXFA_ParaData CXFA_TextProvider::GetParaData() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) - return m_pWidgetAcc->GetPara(); + return m_pWidgetAcc->GetParaData(); CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption, false); - return CXFA_Para(pNode->GetChild(0, XFA_Element::Para, false)); + return CXFA_ParaData(pNode->GetChild(0, XFA_Element::Para, false)); } CXFA_FontData CXFA_TextProvider::GetFontData() { diff --git a/xfa/fxfa/cxfa_textprovider.h b/xfa/fxfa/cxfa_textprovider.h index e6549ef646..df4de8beb7 100644 --- a/xfa/fxfa/cxfa_textprovider.h +++ b/xfa/fxfa/cxfa_textprovider.h @@ -11,7 +11,7 @@ #include "xfa/fxfa/cxfa_textlayout.h" #include "xfa/fxfa/cxfa_widgetacc.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" -#include "xfa/fxfa/parser/cxfa_para.h" +#include "xfa/fxfa/parser/cxfa_paradata.h" class CXFA_FFDoc; class CXFA_Node; @@ -33,7 +33,7 @@ class CXFA_TextProvider { ~CXFA_TextProvider() {} CXFA_Node* GetTextNode(bool& bRichText); - CXFA_Para GetParaNode(); + CXFA_ParaData GetParaData(); CXFA_FontData GetFontData(); bool IsCheckButtonAndAutoWidth(); CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); } diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 7453a145b3..681ecbf0f8 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -781,9 +781,9 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { size.height += fTopInset + fBottomInset; } - CXFA_Para para = GetPara(); - if (para) - size.width += para.GetMarginLeft() + para.GetTextIndent(); + CXFA_ParaData paraData = GetParaData(); + if (paraData) + size.width += paraData.GetMarginLeft() + paraData.GetTextIndent(); float fVal = 0; float fMin = 0; @@ -1245,11 +1245,11 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) { if (fHeight > 0.1f && iBlockIndex == 0) { fStartOffset = fTopInset; fHeight -= (fTopInset + fBottomInset); - if (CXFA_Para para = GetPara()) { - fSpaceAbove = para.GetSpaceAbove(); - float fSpaceBelow = para.GetSpaceBelow(); + if (CXFA_ParaData paraData = GetParaData()) { + fSpaceAbove = paraData.GetSpaceAbove(); + float fSpaceBelow = paraData.GetSpaceBelow(); fHeight -= (fSpaceAbove + fSpaceBelow); - switch (para.GetVerticalAlign()) { + switch (paraData.GetVerticalAlign()) { case XFA_ATTRIBUTEENUM_Top: fStartOffset += fSpaceAbove; break; @@ -1512,8 +1512,8 @@ float CXFA_WidgetAcc::GetFontSize() { float CXFA_WidgetAcc::GetLineHeight() { float fLineHeight = 0; - if (CXFA_Para para = GetPara()) - fLineHeight = para.GetLineHeight(); + if (CXFA_ParaData paraData = GetParaData()) + fLineHeight = paraData.GetLineHeight(); if (fLineHeight < 1) fLineHeight = GetFontSize() * 1.2f; return fLineHeight; diff --git a/xfa/fxfa/parser/cxfa_para.cpp b/xfa/fxfa/parser/cxfa_para.cpp deleted file mode 100644 index 34555a9732..0000000000 --- a/xfa/fxfa/parser/cxfa_para.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_para.h" - -#include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {} - -int32_t CXFA_Para::GetHorizontalAlign() { - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left; - m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_HAlign, eAttr, true); - return eAttr; -} - -int32_t CXFA_Para::GetVerticalAlign() { - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Top; - m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_VAlign, eAttr, true); - return eAttr; -} - -float CXFA_Para::GetLineHeight() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} - -float CXFA_Para::GetMarginLeft() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} - -float CXFA_Para::GetMarginRight() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} - -float CXFA_Para::GetSpaceAbove() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} - -float CXFA_Para::GetSpaceBelow() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} - -float CXFA_Para::GetTextIndent() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} diff --git a/xfa/fxfa/parser/cxfa_para.h b/xfa/fxfa/parser/cxfa_para.h deleted file mode 100644 index c2d67b8a19..0000000000 --- a/xfa/fxfa/parser/cxfa_para.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_PARSER_CXFA_PARA_H_ -#define XFA_FXFA_PARSER_CXFA_PARA_H_ - -#include "core/fxcrt/fx_system.h" -#include "xfa/fxfa/parser/cxfa_data.h" - -class CXFA_Node; - -class CXFA_Para : public CXFA_Data { - public: - explicit CXFA_Para(CXFA_Node* pNode); - - int32_t GetHorizontalAlign(); - int32_t GetVerticalAlign(); - float GetLineHeight(); - float GetMarginLeft(); - float GetMarginRight(); - float GetSpaceAbove(); - float GetSpaceBelow(); - float GetTextIndent(); -}; - -#endif // XFA_FXFA_PARSER_CXFA_PARA_H_ diff --git a/xfa/fxfa/parser/cxfa_paradata.cpp b/xfa/fxfa/parser/cxfa_paradata.cpp new file mode 100644 index 0000000000..44d5c941fd --- /dev/null +++ b/xfa/fxfa/parser/cxfa_paradata.cpp @@ -0,0 +1,60 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fxfa/parser/cxfa_paradata.h" + +#include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" + +CXFA_ParaData::CXFA_ParaData(CXFA_Node* pNode) : CXFA_Data(pNode) {} + +int32_t CXFA_ParaData::GetHorizontalAlign() { + XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left; + m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_HAlign, eAttr, true); + return eAttr; +} + +int32_t CXFA_ParaData::GetVerticalAlign() { + XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Top; + m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_VAlign, eAttr, true); + return eAttr; +} + +float CXFA_ParaData::GetLineHeight() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} + +float CXFA_ParaData::GetMarginLeft() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} + +float CXFA_ParaData::GetMarginRight() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} + +float CXFA_ParaData::GetSpaceAbove() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} + +float CXFA_ParaData::GetSpaceBelow() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} + +float CXFA_ParaData::GetTextIndent() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} diff --git a/xfa/fxfa/parser/cxfa_paradata.h b/xfa/fxfa/parser/cxfa_paradata.h new file mode 100644 index 0000000000..3e0afb36e5 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_paradata.h @@ -0,0 +1,29 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FXFA_PARSER_CXFA_PARADATA_H_ +#define XFA_FXFA_PARSER_CXFA_PARADATA_H_ + +#include "core/fxcrt/fx_system.h" +#include "xfa/fxfa/parser/cxfa_data.h" + +class CXFA_Node; + +class CXFA_ParaData : public CXFA_Data { + public: + explicit CXFA_ParaData(CXFA_Node* pNode); + + int32_t GetHorizontalAlign(); + int32_t GetVerticalAlign(); + float GetLineHeight(); + float GetMarginLeft(); + float GetMarginRight(); + float GetSpaceAbove(); + float GetSpaceBelow(); + float GetTextIndent(); +}; + +#endif // XFA_FXFA_PARSER_CXFA_PARADATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 5edbc7fad4..841fbd065a 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -299,8 +299,9 @@ CXFA_MarginData CXFA_WidgetData::GetMarginData() { m_pNode->JSNode()->GetProperty(0, XFA_Element::Margin, false)); } -CXFA_Para CXFA_WidgetData::GetPara() { - return CXFA_Para(m_pNode->JSNode()->GetProperty(0, XFA_Element::Para, false)); +CXFA_ParaData CXFA_WidgetData::GetParaData() { + return CXFA_ParaData( + m_pNode->JSNode()->GetProperty(0, XFA_Element::Para, false)); } std::vector CXFA_WidgetData::GetEventList() { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 3df30dc5f1..d076b9b01e 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -20,7 +20,7 @@ #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" #include "xfa/fxfa/parser/cxfa_margindata.h" -#include "xfa/fxfa/parser/cxfa_para.h" +#include "xfa/fxfa/parser/cxfa_paradata.h" #include "xfa/fxfa/parser/cxfa_validate.h" enum XFA_CHECKSTATE { @@ -54,7 +54,7 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_CaptionData GetCaptionData(); CXFA_FontData GetFontData(bool bModified); CXFA_MarginData GetMarginData(); - CXFA_Para GetPara(); + CXFA_ParaData GetParaData(); std::vector GetEventList(); std::vector GetEventByActivity(int32_t iActivity, bool bIsFormReady); -- cgit v1.2.3