summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-25 11:17:16 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-25 11:17:16 -0800
commitea1ae9915d1702ab62af520b1487f70a553fc6ae (patch)
tree2fb77cd9537fa4e5a9b02895343d5abe20b51356 /xfa/src
parentf014768833406e68234eeb4f8ba94cabf766dff3 (diff)
downloadpdfium-ea1ae9915d1702ab62af520b1487f70a553fc6ae.tar.xz
Make CFX_PSVTemplate simpler.
Add default ctor so we don't have to zero these out. Also, make CFX_VTemplate simpler. Also, remove the Set() method in favor of assignment. Also, remove CFX_FloatPoint define. Also, remove unused (and wrong) CFX_VTemplate methods. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1733523003 .
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fdp/src/fde/fde_gedevice.cpp14
-rw-r--r--xfa/src/fdp/src/fde/fde_geobject.cpp69
-rw-r--r--xfa/src/fgas/src/layout/fx_rtfbreak.cpp1
-rw-r--r--xfa/src/fgas/src/layout/fx_textbreak.cpp1
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_editimp.cpp9
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_listboximp.cpp2
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp125
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp6
-rw-r--r--xfa/src/fwl/src/core/fwl_formimp.cpp15
-rw-r--r--xfa/src/fwl/src/core/fwl_noteimp.cpp9
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp28
-rw-r--r--xfa/src/fwl/src/lightwidget/tooltipctrl.cpp1
-rw-r--r--xfa/src/fwl/src/lightwidget/widget.cpp11
-rw-r--r--xfa/src/fwl/src/theme/checkboxtp.cpp61
-rw-r--r--xfa/src/fwl/src/theme/widgettp.cpp10
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp8
-rw-r--r--xfa/src/fxfa/src/app/xfa_fffield.cpp19
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp3
-rw-r--r--xfa/src/fxfa/src/app/xfa_fftextedit.cpp8
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidget.cpp23
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp10
-rw-r--r--xfa/src/fxfa/src/app/xfa_fwltheme.cpp1
-rw-r--r--xfa/src/fxfa/src/app/xfa_textlayout.cpp15
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp19
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp56
25 files changed, 226 insertions, 298 deletions
diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp
index 1abb656fea..75201af133 100644
--- a/xfa/src/fdp/src/fde/fde_gedevice.cpp
+++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp
@@ -445,13 +445,12 @@ FX_BOOL CFDE_FxgeDevice::FillTexturePath(IFDE_Brush* pBrush,
const CFX_PathData* pPath,
const CFX_Matrix* pMatrix) {
FXSYS_assert(pPath && pBrush && pBrush->GetType() == FDE_BRUSHTYPE_Texture);
- IFDE_TextureBrush* pTextureBrush = (IFDE_TextureBrush*)pBrush;
- IFDE_Image* pImage = (IFDE_Image*)pTextureBrush->GetImage();
- if (pImage == NULL) {
+ IFDE_TextureBrush* pTextureBrush = static_cast<IFDE_TextureBrush*>(pBrush);
+ IFDE_Image* pImage = pTextureBrush->GetImage();
+ if (!pImage)
return FALSE;
- }
- CFX_Size size;
- size.Set(pImage->GetImageWidth(), pImage->GetImageHeight());
+
+ CFX_Size size(pImage->GetImageWidth(), pImage->GetImageHeight());
CFX_DIBitmap bmp;
bmp.Create(size.x, size.y, FXDIB_Argb);
if (!pImage->StartLoadImage(&bmp, 0, 0, size.x, size.y, 0, 0, size.x,
@@ -532,8 +531,7 @@ FX_BOOL CFDE_FxgeDevice::FillLinearGradientPath(IFDE_Brush* pBrush,
IFDE_LinearGradientBrush* pLinearBrush = (IFDE_LinearGradientBrush*)pBrush;
CFX_PointF pt0, pt1;
pLinearBrush->GetLinearPoints(pt0, pt1);
- CFX_VectorF fDiagonal;
- fDiagonal.Set(pt0, pt1);
+ CFX_VectorF fDiagonal(pt0, pt1);
FX_FLOAT fTheta = FXSYS_atan2(fDiagonal.y, fDiagonal.x);
FX_FLOAT fLength = fDiagonal.Length();
FX_FLOAT fTotalX = fLength / FXSYS_cos(fTheta);
diff --git a/xfa/src/fdp/src/fde/fde_geobject.cpp b/xfa/src/fdp/src/fde/fde_geobject.cpp
index 748bbb3f77..ffe0ff0b9a 100644
--- a/xfa/src/fdp/src/fde/fde_geobject.cpp
+++ b/xfa/src/fdp/src/fde/fde_geobject.cpp
@@ -94,26 +94,21 @@ void CFDE_Path::ArcTo(FX_BOOL bStart,
FX_FLOAT sin_beta = FXSYS_sin(beta);
FX_FLOAT cos_alpha = FXSYS_cos(alpha);
FX_FLOAT cos_beta = FXSYS_cos(beta);
- if (bStart) {
- CFX_PointF p0;
- p0.Set(cx + rx * cos_alpha, cy + ry * sin_alpha);
- MoveTo(p0);
- }
- CFX_PointF p1;
- p1.Set(cx + rx * (cos_alpha - bcp * sin_alpha),
- cy + ry * (sin_alpha + bcp * cos_alpha));
- CFX_PointF p2;
- p2.Set(cx + rx * (cos_beta + bcp * sin_beta),
- cy + ry * (sin_beta - bcp * cos_beta));
- CFX_PointF p3;
- p3.Set(cx + rx * cos_beta, cy + ry * sin_beta);
- BezierTo(p1, p2, p3);
+ if (bStart)
+ MoveTo(CFX_PointF(cx + rx * cos_alpha, cy + ry * sin_alpha));
+
+ BezierTo(CFX_PointF(cx + rx * (cos_alpha - bcp * sin_alpha),
+ cy + ry * (sin_alpha + bcp * cos_alpha)),
+ CFX_PointF(cx + rx * (cos_beta + bcp * sin_beta),
+ cy + ry * (sin_beta - bcp * cos_beta)),
+ CFX_PointF(cx + rx * cos_beta, cy + ry * sin_beta));
}
+
void CFDE_Path::AddBezier(const CFX_PointsF& points) {
if (points.GetSize() != 4) {
return;
}
- FX_LPCPOINTF p = points.GetData();
+ const CFX_PointF* p = points.GetData();
MoveTo(p[0]);
BezierTo(p[1], p[2], p[3]);
}
@@ -122,8 +117,8 @@ void CFDE_Path::AddBeziers(const CFX_PointsF& points) {
if (iCount < 4) {
return;
}
- FX_LPCPOINTF p = points.GetData();
- FX_LPCPOINTF pEnd = p + iCount;
+ const CFX_PointF* p = points.GetData();
+ const CFX_PointF* pEnd = p + iCount;
MoveTo(p[0]);
for (++p; p <= pEnd - 3; p += 3) {
BezierTo(p[0], p[1], p[2]);
@@ -139,8 +134,8 @@ void CFDE_Path::GetCurveTangents(const CFX_PointsF& points,
return;
}
FX_FLOAT fCoefficient = fTension / 3.0f;
- FX_LPCPOINTF pPoints = points.GetData();
- FX_LPPOINTF pTangents = tangents.GetData();
+ const CFX_PointF* pPoints = points.GetData();
+ CFX_PointF* pTangents = tangents.GetData();
for (int32_t i = 0; i < iCount; ++i) {
int32_t r = i + 1;
int32_t s = i - 1;
@@ -163,28 +158,22 @@ void CFDE_Path::AddCurve(const CFX_PointsF& points,
}
CFX_PointsF tangents;
GetCurveTangents(points, tangents, bClosed, fTension);
- FX_LPCPOINTF pPoints = points.GetData();
- FX_LPPOINTF pTangents = tangents.GetData();
+ const CFX_PointF* pPoints = points.GetData();
+ CFX_PointF* pTangents = tangents.GetData();
MoveTo(pPoints[0]);
for (int32_t i = 0; i < iLast; ++i) {
- int32_t j = i + 1;
- CFX_PointF p1;
- p1.Set(pPoints[i].x + pTangents[i].x, pPoints[i].y + pTangents[i].y);
- CFX_PointF p2;
- p2.Set(pPoints[j].x - pTangents[j].x, pPoints[j].y - pTangents[j].y);
- CFX_PointF p3;
- p3.Set(pPoints[j].x, pPoints[j].y);
- BezierTo(p1, p2, p3);
+ BezierTo(CFX_PointF(pPoints[i].x + pTangents[i].x,
+ pPoints[i].y + pTangents[i].y),
+ CFX_PointF(pPoints[i + 1].x - pTangents[i + 1].x,
+ pPoints[i + 1].y - pTangents[i + 1].y),
+ CFX_PointF(pPoints[i + 1].x, pPoints[i + 1].y));
}
if (bClosed) {
- CFX_PointF p1;
- p1.Set(pPoints[iLast].x + pTangents[iLast].x,
- pPoints[iLast].y + pTangents[iLast].y);
- CFX_PointF p2;
- p2.Set(pPoints[0].x - pTangents[0].x, pPoints[0].y - pTangents[0].y);
- CFX_PointF p3;
- p3.Set(pPoints[0].x, pPoints[0].y);
- BezierTo(p1, p2, p3);
+ BezierTo(CFX_PointF(pPoints[iLast].x + pTangents[iLast].x,
+ pPoints[iLast].y + pTangents[iLast].y),
+ CFX_PointF(pPoints[0].x - pTangents[0].x,
+ pPoints[0].y - pTangents[0].y),
+ CFX_PointF(pPoints[0].x, pPoints[0].y));
CloseFigure();
}
}
@@ -226,7 +215,7 @@ void CFDE_Path::AddPolygon(const CFX_PointsF& points) {
return;
}
AddLines(points);
- FX_LPCPOINTF p = points.GetData();
+ const CFX_PointF* p = points.GetData();
if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f ||
FXSYS_fabs(p[0].y - p[iCount - 1].y) < 0.01f) {
LineTo(p[0]);
@@ -238,8 +227,8 @@ void CFDE_Path::AddLines(const CFX_PointsF& points) {
if (iCount < 2) {
return;
}
- FX_LPCPOINTF p = points.GetData();
- FX_LPCPOINTF pEnd = p + iCount;
+ const CFX_PointF* p = points.GetData();
+ const CFX_PointF* pEnd = p + iCount;
MoveTo(p[0]);
for (++p; p < pEnd; ++p) {
LineTo(*p);
diff --git a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
index 20bbf99981..d76b76d3f1 100644
--- a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
+++ b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
@@ -1314,7 +1314,6 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
}
if (!bEmptyChar) {
CFX_PointF ptOffset;
- ptOffset.Reset();
FX_BOOL bAdjusted = FALSE;
if (pAdjustPos) {
bAdjusted = pAdjustPos(wForm, bMBCSCode, pFont, fFontSize,
diff --git a/xfa/src/fgas/src/layout/fx_textbreak.cpp b/xfa/src/fgas/src/layout/fx_textbreak.cpp
index 700af7975e..d3ea85ebd0 100644
--- a/xfa/src/fgas/src/layout/fx_textbreak.cpp
+++ b/xfa/src/fgas/src/layout/fx_textbreak.cpp
@@ -1448,7 +1448,6 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
}
CFX_PointF ptOffset;
- ptOffset.Reset();
FX_BOOL bAdjusted = FALSE;
if (pAdjustPos) {
bAdjusted = pAdjustPos(wForm, bCharCode, pFont, fFontSize,
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
index 38940f2e8d..100a25dde6 100644
--- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
@@ -1816,8 +1816,7 @@ void CFWL_EditImpDelegate::DoButtonDown(CFWL_MsgMouse* pMsg) {
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
if (!pPage)
return;
- CFX_PointF pt;
- pt.Set(pMsg->m_fx, pMsg->m_fy);
+ CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
FX_BOOL bBefore = TRUE;
int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
@@ -1900,8 +1899,7 @@ void CFWL_EditImpDelegate::OnButtonDblClk(CFWL_MsgMouse* pMsg) {
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
if (!pPage)
return;
- CFX_PointF pt;
- pt.Set(pMsg->m_fx, pMsg->m_fy);
+ CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
int32_t nCount = 0;
int32_t nIndex = pPage->SelectWord(pt, nCount);
@@ -1922,8 +1920,7 @@ void CFWL_EditImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
if (!pPage)
return;
- CFX_PointF pt;
- pt.Set(pMsg->m_fx, pMsg->m_fy);
+ CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
FX_BOOL bBefore = TRUE;
int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
index 149d3fd0e3..f2885dc25e 100644
--- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
@@ -723,9 +723,9 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
}
CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
- fs.Set(0, 0);
if (!m_pProperties->m_pThemeProvider)
return fs;
+
GetClientRect(m_rtClient);
m_rtConent = m_rtClient;
CFX_RectF rtUIMargin;
diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
index 264c4b71ed..aee5cb60c3 100644
--- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
@@ -6,6 +6,8 @@
#include "xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h"
+#include <algorithm>
+
#include "xfa/include/fwl/basewidget/fwl_monthcalendar.h"
#include "xfa/include/fwl/core/fwl_theme.h"
#include "xfa/src/foxitlib.h"
@@ -75,9 +77,6 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
m_rtClient.Reset();
m_rtWeekNum.Reset();
m_rtWeekNumSep.Reset();
- m_szHead.Reset();
- m_szCell.Reset();
- m_szToday.Reset();
m_pDateTime = new CFX_DateTime;
m_bInit = FALSE;
m_iMaxSel = 1;
@@ -498,72 +497,70 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&params);
}
CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
- CFX_SizeF fs;
- fs.Set(0, 0);
if (!m_pProperties->m_pThemeProvider)
- return fs;
- if (bAutoSize) {
- CFWL_ThemePart params;
- params.m_pWidget = m_pInterface;
- IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
- CFX_WideString* wsText = NULL;
- FX_FLOAT fMaxWeekW = 0.0f;
- FX_FLOAT fMaxWeekH = 0.0f;
- for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat;
- week++) {
- wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, week));
- CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
- fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x;
- fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y;
- }
- FX_FLOAT fDayMaxW = 0.0f;
- FX_FLOAT fDayMaxH = 0.0f;
- for (int day = 10; day <= 31; day++) {
- CFX_WideString wsDay;
- wsDay.Format(L"%d", day);
- CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider);
- fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x;
- fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y;
- }
- m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5)
- : (int)(fDayMaxW + 0.5));
- m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH;
- fs.x = m_szCell.x * MONTHCAL_COLUMNS +
- MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 +
- MONTHCAL_HEADER_BTN_HMARGIN * 2;
- FX_FLOAT fMonthMaxW = 0.0f;
- FX_FLOAT fMonthMaxH = 0.0f;
- for (FX_DWORD month = FWL_MCCAPACITY_January;
- month <= FWL_MCCAPACITY_December; month++) {
- wsText =
- static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, month));
- CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
- fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x;
- fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y;
- }
- CFX_WideString wsYear;
- GetHeadText(m_iYear, m_iMonth, wsYear);
- CFX_SizeF szYear = CalcTextSize(wsYear, m_pProperties->m_pThemeProvider);
- fMonthMaxH = (fMonthMaxH >= szYear.y) ? fMonthMaxH : szYear.y;
- m_szHead.Set(fMonthMaxW + szYear.x, fMonthMaxH);
- fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2;
- fs.x = (fs.x >= fMonthMaxW) ? fs.x : fMonthMaxW;
- CFX_WideString wsToday;
- GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday);
- wsText = static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, FWL_MCCAPACITY_Today));
- m_wsToday = *wsText + wsToday;
- m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider);
- m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y;
- fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y +
- MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 +
- MONTHCAL_HEADER_BTN_VMARGIN * 4;
- } else {
+ return CFX_SizeF();
+
+ if (!bAutoSize) {
GetClientRect(m_rtClient);
- fs.Set(m_rtClient.width, m_rtClient.height);
+ return CFX_SizeF(m_rtClient.width, m_rtClient.height);
+ }
+
+ CFX_SizeF fs;
+ CFWL_ThemePart params;
+ params.m_pWidget = m_pInterface;
+ IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
+ CFX_WideString* wsText = NULL;
+ FX_FLOAT fMaxWeekW = 0.0f;
+ FX_FLOAT fMaxWeekH = 0.0f;
+ for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat; week++) {
+ wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, week));
+ CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
+ fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x;
+ fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y;
}
+ FX_FLOAT fDayMaxW = 0.0f;
+ FX_FLOAT fDayMaxH = 0.0f;
+ for (int day = 10; day <= 31; day++) {
+ CFX_WideString wsDay;
+ wsDay.Format(L"%d", day);
+ CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider);
+ fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x;
+ fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y;
+ }
+ m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5)
+ : (int)(fDayMaxW + 0.5));
+ m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH;
+ fs.x = m_szCell.x * MONTHCAL_COLUMNS +
+ MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 +
+ MONTHCAL_HEADER_BTN_HMARGIN * 2;
+ FX_FLOAT fMonthMaxW = 0.0f;
+ FX_FLOAT fMonthMaxH = 0.0f;
+ for (FX_DWORD month = FWL_MCCAPACITY_January;
+ month <= FWL_MCCAPACITY_December; month++) {
+ wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, month));
+ CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
+ fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x;
+ fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y;
+ }
+ CFX_WideString wsYear;
+ GetHeadText(m_iYear, m_iMonth, wsYear);
+ CFX_SizeF szYear = CalcTextSize(wsYear, m_pProperties->m_pThemeProvider);
+ fMonthMaxH = std::max(fMonthMaxH, szYear.y);
+ m_szHead = CFX_SizeF(fMonthMaxW + szYear.x, fMonthMaxH);
+ fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2;
+ fs.x = std::max(fs.x, fMonthMaxW);
+ CFX_WideString wsToday;
+ GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday);
+ wsText = static_cast<CFX_WideString*>(
+ pTheme->GetCapacity(&params, FWL_MCCAPACITY_Today));
+ m_wsToday = *wsText + wsToday;
+ m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider);
+ m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y;
+ fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y +
+ MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + MONTHCAL_HEADER_BTN_VMARGIN * 4;
return fs;
}
+
void CFWL_MonthCalendarImp::CalcHeadSize() {
FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2;
FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2;
diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
index e04445acad..ba349af8ba 100644
--- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
@@ -122,9 +122,9 @@ void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics,
if (fy > m_rtClient.height) {
fy = m_rtClient.height;
}
- CFX_PointF pt;
- pt.Set((m_rtClient.width - fx) / 2, (m_rtClient.height - fy) / 2);
- pGraphics->DrawImage(pPicture, pt, &matrix);
+ pGraphics->DrawImage(pPicture, CFX_PointF((m_rtClient.width - fx) / 2,
+ (m_rtClient.height - fy) / 2),
+ &matrix);
}
FX_BOOL CFWL_PictureBoxImp::VStyle(FX_BOOL dwStyle) {
switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) {
diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp
index b111cbbe28..8622f2081c 100644
--- a/xfa/src/fwl/src/core/fwl_formimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_formimp.cpp
@@ -83,15 +83,10 @@ CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties,
m_rtRestore.Reset();
m_rtCaptionText.Reset();
m_rtIcon.Reset();
- m_InfoStart.m_ptStart.Reset();
- m_InfoStart.m_szStart.Reset();
}
CFWL_FormImp::~CFWL_FormImp() {
RemoveSysButtons();
- if (m_pNoteLoop) {
- delete m_pNoteLoop;
- m_pNoteLoop = NULL;
- }
+ delete m_pNoteLoop;
}
FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Form;
@@ -1036,10 +1031,10 @@ void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
!m_pOwner->m_bMaximized) {
m_pOwner->SetCursor(pMsg->m_fx, pMsg->m_fy);
}
- m_pOwner->m_InfoStart.m_ptStart.Set(pMsg->m_fx, pMsg->m_fy);
- m_pOwner->m_InfoStart.m_szStart.Set(
- m_pOwner->m_pProperties->m_rtWidget.width,
- m_pOwner->m_pProperties->m_rtWidget.height);
+ m_pOwner->m_InfoStart.m_ptStart = CFX_PointF(pMsg->m_fx, pMsg->m_fy);
+ m_pOwner->m_InfoStart.m_szStart =
+ CFX_SizeF(m_pOwner->m_pProperties->m_rtWidget.width,
+ m_pOwner->m_pProperties->m_rtWidget.height);
}
void CFWL_FormImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->SetGrab(FALSE);
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp
index 9bdb04f1a5..8de329a5cc 100644
--- a/xfa/src/fwl/src/core/fwl_noteimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp
@@ -839,9 +839,7 @@ CFX_DIBitmap* CFWL_CoreToopTipDP::GetToolTipIcon(IFWL_Widget* pWidget) {
return NULL;
}
CFX_SizeF CFWL_CoreToopTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) {
- CFX_SizeF sz;
- sz.Set(0, 0);
- return sz;
+ return CFX_SizeF();
}
CFX_RectF CFWL_CoreToopTipDP::GetAnchor() {
return m_fAnchor;
@@ -1007,9 +1005,7 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
m_ToolTipDp->m_wsCaption = wsCaption;
}
CFX_RectF rt;
- rt.Reset();
CFX_SizeF sz;
- sz.Reset();
pCurTarget->GetToolTipSize(sz);
if (sz.x > 0 && sz.y > 0) {
rt.width = sz.x;
@@ -1020,8 +1016,7 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
rt.width = r.width;
rt.height = r.height;
}
- CFX_PointF pt;
- pt.Set(pEvt->m_fx, pEvt->m_fy);
+ CFX_PointF pt(pEvt->m_fx, pEvt->m_fy);
if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) {
rt.left = pt.x;
rt.top = pt.y;
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index eb180a19e0..a4678c2c70 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -652,10 +652,9 @@ CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText,
IFWL_ThemeProvider* pTheme,
FX_BOOL bMultiLine,
int32_t iLineWidth) {
- CFX_SizeF sz;
- sz.Set(0, 0);
if (!pTheme)
- return sz;
+ return CFX_SizeF();
+
CFWL_ThemeText calPart;
calPart.m_pWidget = m_pInterface;
calPart.m_wsText = wsText;
@@ -669,9 +668,7 @@ CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText,
: FWL_WGT_CalcWidth;
rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight);
pTheme->CalcTextRect(&calPart, rect);
- sz.x = rect.width;
- sz.y = rect.height;
- return sz;
+ return CFX_SizeF(rect.width, rect.height);
}
void CFWL_WidgetImp::CalcTextRect(const CFX_WideString& wsText,
IFWL_ThemeProvider* pTheme,
@@ -930,22 +927,21 @@ void CFWL_WidgetImp::NotifyDriver() {
pDriver->NotifyTargetDestroy(m_pInterface);
}
CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
- CFX_SizeF szRet;
- szRet.Set(0, 0);
- if (pParent == GetInterface()) {
- return szRet;
- }
+ if (pParent == GetInterface())
+ return CFX_SizeF();
+
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
if (!pWidgetMgr)
- return szRet;
- szRet.x += m_pProperties->m_rtWidget.left;
- szRet.y += m_pProperties->m_rtWidget.top;
+ return CFX_SizeF();
+
+ CFX_SizeF szRet(m_pProperties->m_rtWidget.left,
+ m_pProperties->m_rtWidget.top);
+
IFWL_Widget* pDstWidget = GetParent();
while (pDstWidget && pDstWidget != pParent) {
CFX_RectF rtDst;
pDstWidget->GetWidgetRect(rtDst);
- szRet.x += rtDst.left;
- szRet.y += rtDst.top;
+ szRet += CFX_SizeF(rtDst.left, rtDst.top);
pDstWidget = pWidgetMgr->GetWidget(pDstWidget, FWL_WGTRELATION_Parent);
}
return szRet;
diff --git a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
index 9891a3b04a..d3ce414e00 100644
--- a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
+++ b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
@@ -86,7 +86,6 @@ CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) {
m_wsCaption = L"";
m_nInitDelayTime = 500;
m_nAutoPopDelayTime = 50000;
- m_fIconSize.Set(0.0, 0.0);
m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
}
FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget,
diff --git a/xfa/src/fwl/src/lightwidget/widget.cpp b/xfa/src/fwl/src/lightwidget/widget.cpp
index 896ff80be3..6c65798eaf 100644
--- a/xfa/src/fwl/src/lightwidget/widget.cpp
+++ b/xfa/src/fwl/src/lightwidget/widget.cpp
@@ -283,13 +283,12 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
FX_BOOL bMultiLine,
int32_t iLineWidth) {
- CFX_SizeF sz;
- sz.Set(0, 0);
if (!m_pIface)
- return sz;
+ return CFX_SizeF();
IFWL_ThemeProvider* pTheme = m_pIface->GetThemeProvider();
if (!pTheme)
- return sz;
+ return CFX_SizeF();
+
CFWL_ThemeText calPart;
calPart.m_pWidget = m_pIface;
calPart.m_wsText = wsText;
@@ -303,9 +302,7 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
: FWL_WGT_CalcWidth;
rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight);
pTheme->CalcTextRect(&calPart, rect);
- sz.x = rect.width;
- sz.y = rect.height;
- return sz;
+ return CFX_SizeF(rect.width, rect.height);
}
CFWL_WidgetDelegate::CFWL_WidgetDelegate() {}
CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {}
diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp
index 3cc6f43622..69a996bbe0 100644
--- a/xfa/src/fwl/src/theme/checkboxtp.cpp
+++ b/xfa/src/fwl/src/theme/checkboxtp.cpp
@@ -334,9 +334,8 @@ void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
FX_FLOAT fBottom = pRtSign->bottom();
FX_FLOAT fRadius =
(pRtSign->top - fBottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
- CFX_PointF ptCenter;
- ptCenter.Set((pRtSign->left + pRtSign->right()) / 2.0f,
- (pRtSign->top + fBottom) / 2.0f);
+ CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f,
+ (pRtSign->top + fBottom) / 2.0f);
FX_FLOAT px[5], py[5];
FX_FLOAT fAngel = FX_PI / 10.0f;
for (int32_t i = 0; i < 5; i++) {
@@ -466,42 +465,28 @@ void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) {
FX_FLOAT fWidth = CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT fHeight = -CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT fBottom = CHECKBOX_SIZE_SIGNPATH;
- FX_FLOAT px1, py1, px2, py2;
- CFX_PointF pt1;
- pt1.Set(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
- CFX_PointF pt2;
- pt2.Set(fWidth / 4.5f, fBottom + fHeight / 16.0f);
- CFX_PointF pt3;
- pt3.Set(fWidth / 3.0f, fBottom);
- CFX_PointF pt4;
- pt4.Set(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
- CFX_PointF pt5;
- pt5.Set(fWidth / 3.6f, fBottom + fHeight / 3.5f);
- CFX_PointF pt12;
- pt12.Set(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
- CFX_PointF pt21;
- pt21.Set(fWidth / 5.0f, fBottom + fHeight / 5.0f);
- CFX_PointF pt23;
- pt23.Set(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
- CFX_PointF pt32;
- pt32.Set(fWidth / 4.0f, fBottom);
- CFX_PointF pt34;
- pt34.Set(fWidth * (1 / 7.0f + 7 / 15.0f), fBottom + fHeight * 4 / 5.0f);
- CFX_PointF pt43;
- pt43.Set(fWidth * (1 / 7.0f + 7 / 15.0f), fBottom + fHeight * 4 / 5.0f);
- CFX_PointF pt45;
- pt45.Set(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
- CFX_PointF pt54;
- pt54.Set(fWidth / 3.4f, fBottom + fHeight / 3.5f);
- CFX_PointF pt51;
- pt51.Set(fWidth / 3.6f, fBottom + fHeight / 4.0f);
- CFX_PointF pt15;
- pt15.Set(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
+ CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
+ CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
+ CFX_PointF pt3(fWidth / 3.0f, fBottom);
+ CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
+ CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
+ CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
+ CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
+ CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
+ CFX_PointF pt32(fWidth / 4.0f, fBottom);
+ CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
+ fBottom + fHeight * 4 / 5.0f);
+ CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
+ fBottom + fHeight * 4 / 5.0f);
+ CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
+ CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
+ CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
+ CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
m_pCheckPath->MoveTo(pt1.x, pt1.y);
- px1 = pt12.x - pt1.x;
- py1 = pt12.y - pt1.y;
- px2 = pt21.x - pt2.x;
- py2 = pt21.y - pt2.y;
+ FX_FLOAT px1 = pt12.x - pt1.x;
+ FX_FLOAT py1 = pt12.y - pt1.y;
+ FX_FLOAT px2 = pt21.x - pt2.x;
+ FX_FLOAT py2 = pt21.y - pt2.y;
m_pCheckPath->BezierTo(pt1.x + px1 * FWLTHEME_BEZIER,
pt1.y + py1 * FWLTHEME_BEZIER,
pt2.x + px2 * FWLTHEME_BEZIER,
diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp
index 10ed696aa0..89195a501c 100644
--- a/xfa/src/fwl/src/theme/widgettp.cpp
+++ b/xfa/src/fwl/src/theme/widgettp.cpp
@@ -446,13 +446,11 @@ void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics,
CFX_Path* path,
int32_t fillMode,
CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!path)
+ if (!pGraphics || !path)
return;
- CFX_PointF begPoint, endPoint;
- begPoint.Set(fx1, fy1);
- endPoint.Set(fx2, fy2);
+
+ CFX_PointF begPoint(fx1, fy1);
+ CFX_PointF endPoint(fx2, fy2);
CFX_Shading shading;
shading.CreateAxial(begPoint, endPoint, FALSE, FALSE, beginColor, endColor);
pGraphics->SaveGraphState();
diff --git a/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp b/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp
index 67b5cc3110..2d68887d0e 100644
--- a/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffchoicelist.cpp
@@ -293,12 +293,10 @@ void CXFA_FFComboBox::UpdateWidgetProperty() {
FX_BOOL CXFA_FFComboBox::OnRButtonUp(FX_DWORD dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) {
+ if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy))
return FALSE;
- }
- CFX_PointF pt;
- pt.Set(fx, fy);
- GetDoc()->GetDocProvider()->PopupMenu(this, pt, NULL);
+
+ GetDoc()->GetDocProvider()->PopupMenu(this, CFX_PointF(fx, fy), nullptr);
return TRUE;
}
FX_BOOL CXFA_FFComboBox::OnKillFocus(CXFA_FFWidget* pNewWidget) {
diff --git a/xfa/src/fxfa/src/app/xfa_fffield.cpp b/xfa/src/fxfa/src/app/xfa_fffield.cpp
index 63fb9f07d8..7616dcbdb3 100644
--- a/xfa/src/fxfa/src/app/xfa_fffield.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fffield.cpp
@@ -217,11 +217,8 @@ void CXFA_FFField::CapPlacement() {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
if (fCapReserve <= 0 && pCapTextLayout) {
CFX_SizeF size;
- size.Set(0, 0);
CFX_SizeF minSize;
- minSize.Set(0, 0);
CFX_SizeF maxSize;
- maxSize.Set(0, 0);
pCapTextLayout->CalcSize(minSize, maxSize, size);
if (iCapPlacement == XFA_ATTRIBUTEENUM_Top ||
iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) {
@@ -646,16 +643,14 @@ FX_BOOL CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
}
void CXFA_FFField::LayoutCaption() {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
- if (!pCapTextLayout) {
+ if (!pCapTextLayout)
return;
- }
- CFX_SizeF size;
- size.Set(m_rtCaption.width, m_rtCaption.height);
+
FX_FLOAT fHeight = 0;
- pCapTextLayout->Layout(size, &fHeight);
- if (m_rtCaption.height < fHeight) {
+ pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height),
+ &fHeight);
+ if (m_rtCaption.height < fHeight)
m_rtCaption.height = fHeight;
- }
}
void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
@@ -665,9 +660,7 @@ void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
if (!pCapTextLayout->IsLoaded()) {
- CFX_SizeF size;
- size.Set(m_rtCaption.width, m_rtCaption.height);
- pCapTextLayout->Layout(size);
+ pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height));
}
CFX_RectF rtWidget;
GetRectWithoutRotate(rtWidget);
diff --git a/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp b/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp
index 3b5a462188..e6efa13b86 100644
--- a/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp
@@ -162,8 +162,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() {
}
}
void CXFA_FFPushButton::LayoutHighlightCaption() {
- CFX_SizeF sz;
- sz.Set(m_rtCaption.width, m_rtCaption.height);
+ CFX_SizeF sz(m_rtCaption.width, m_rtCaption.height);
LayoutCaption();
if (m_pRolloverTextLayout) {
m_pRolloverTextLayout->Layout(sz);
diff --git a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp
index cb907b5dff..e9fd220272 100644
--- a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp
@@ -140,12 +140,10 @@ FX_BOOL CXFA_FFTextEdit::OnRButtonDown(FX_DWORD dwFlags,
FX_BOOL CXFA_FFTextEdit::OnRButtonUp(FX_DWORD dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) {
+ if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy))
return FALSE;
- }
- CFX_PointF pt;
- pt.Set(fx, fy);
- GetDoc()->GetDocProvider()->PopupMenu(this, pt, NULL);
+
+ GetDoc()->GetDocProvider()->PopupMenu(this, CFX_PointF(fx, fy), nullptr);
return TRUE;
}
FX_BOOL CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) {
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
index 0f48d5d4a5..47042f71af 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
@@ -1510,26 +1510,27 @@ static void XFA_BOX_Fill_Linear(CXFA_Box box,
CFX_RectF rtFill,
CFX_Matrix* pMatrix) {
CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart, crEnd;
- crStart = fill.GetColor();
+ FX_ARGB crStart = fill.GetColor();
+ FX_ARGB crEnd;
int32_t iType = fill.GetLinear(crEnd);
- CFX_PointF ptStart, ptEnd;
+ CFX_PointF ptStart;
+ CFX_PointF ptEnd;
switch (iType) {
case XFA_ATTRIBUTEENUM_ToRight:
- ptStart.Set(rtFill.left, rtFill.top);
- ptEnd.Set(rtFill.right(), rtFill.top);
+ ptStart = CFX_PointF(rtFill.left, rtFill.top);
+ ptEnd = CFX_PointF(rtFill.right(), rtFill.top);
break;
case XFA_ATTRIBUTEENUM_ToBottom:
- ptStart.Set(rtFill.left, rtFill.top);
- ptEnd.Set(rtFill.left, rtFill.bottom());
+ ptStart = CFX_PointF(rtFill.left, rtFill.top);
+ ptEnd = CFX_PointF(rtFill.left, rtFill.bottom());
break;
case XFA_ATTRIBUTEENUM_ToLeft:
- ptStart.Set(rtFill.right(), rtFill.top);
- ptEnd.Set(rtFill.left, rtFill.top);
+ ptStart = CFX_PointF(rtFill.right(), rtFill.top);
+ ptEnd = CFX_PointF(rtFill.left, rtFill.top);
break;
case XFA_ATTRIBUTEENUM_ToTop:
- ptStart.Set(rtFill.left, rtFill.bottom());
- ptEnd.Set(rtFill.left, rtFill.top);
+ ptStart = CFX_PointF(rtFill.left, rtFill.bottom());
+ ptEnd = CFX_PointF(rtFill.left, rtFill.top);
break;
default:
break;
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
index 0178a281e7..a51017bce1 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
@@ -778,7 +778,6 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
szCap.x = fCapReserve;
}
CFX_SizeF minSize;
- minSize.Set(0, 0);
pCapTextLayout->CalcSize(minSize, szCap, szCap);
if (bReserveExit) {
bVert ? szCap.y = fCapReserve : szCap.x = fCapReserve;
@@ -814,7 +813,6 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
}
FX_BOOL CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) {
CFX_SizeF szCap;
- szCap.Set(0, 0);
CalcCaptionSize(szCap);
CFX_RectF rtUIMargin;
GetUIMargin(rtUIMargin);
@@ -913,7 +911,6 @@ FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
if (size.x > 0) {
CFX_SizeF szOrz = size;
CFX_SizeF szCap;
- szCap.Set(0, 0);
CalcCaptionSize(szCap);
FX_BOOL bCapExit = szCap.x > 0.01 && szCap.y > 0.01;
int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
@@ -975,7 +972,7 @@ FX_BOOL CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) {
if (!GetImageImage()) {
LoadImageImage();
}
- size.Set(0, 0);
+ size.clear();
if (CFX_DIBitmap* pBitmap = GetImageImage()) {
CFX_RectF rtImage, rtFit;
rtImage.Set(0, 0, 0, 0);
@@ -1006,7 +1003,7 @@ FX_BOOL CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) {
if (!GetImageEditImage()) {
LoadImageEditImage();
}
- size.Set(0, 0);
+ size.clear();
if (CFX_DIBitmap* pBitmap = GetImageEditImage()) {
CFX_RectF rtImage, rtFit;
rtImage.Set(0, 0, 0, 0);
@@ -1150,8 +1147,7 @@ void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth,
void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_ELEMENT eUIType,
FX_FLOAT& fWidth,
FX_FLOAT& fCalcHeight) {
- CFX_SizeF sz;
- sz.Set(fWidth, m_pLayoutData->m_fWidgetHeight);
+ CFX_SizeF sz(fWidth, m_pLayoutData->m_fWidgetHeight);
switch (eUIType) {
case XFA_ELEMENT_Barcode:
case XFA_ELEMENT_ChoiceList:
diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
index 2d497a29b8..fe4a2af9c9 100644
--- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
@@ -36,7 +36,6 @@ CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) {
m_fCapacity = 0;
m_pCalendarFont = NULL;
m_Rect.Set(0, 0, 0, 0);
- m_SizeAboveBelow.Set(0, 0);
m_pCheckBoxTP = new CXFA_FWLCheckBoxTP;
m_pListBoxTP = new CFWL_ListBoxTP;
m_pPictureBoxTP = new CFWL_PictureBoxTP;
diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp
index d1495c4add..1c1dad7e42 100644
--- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp
+++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp
@@ -897,9 +897,8 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
}
int32_t iCount = m_pLoader->m_lineHeights.GetSize();
if (iCount == 0 && m_pLoader->m_fWidth > 0) {
- CFX_SizeF szMax, szDef;
- szMax.Set(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
- szDef.Set(0, 0);
+ CFX_SizeF szMax(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
+ CFX_SizeF szDef;
m_pLoader->m_bSaveLineHeight = TRUE;
m_pLoader->m_fLastPos = 0;
CalcSize(szMax, szMax, szDef);
@@ -928,9 +927,8 @@ FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) {
}
m_pLoader->m_fWidth = fWidth;
if (fWidth < 0) {
- CFX_SizeF szMax, szDef;
- szMax.Set(0, 0);
- szDef.Set(0, 0);
+ CFX_SizeF szMax;
+ CFX_SizeF szDef;
m_pLoader->m_bSaveLineHeight = TRUE;
m_pLoader->m_fLastPos = 0;
CalcSize(szMax, szMax, szDef);
@@ -1045,7 +1043,7 @@ FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
delete m_pTabstopContext;
m_pTabstopContext = NULL;
}
- defaultSize.Set(m_fMaxWidth, fLinePos);
+ defaultSize = CFX_SizeF(m_fMaxWidth, fLinePos);
return TRUE;
}
FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
@@ -1082,8 +1080,7 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
m_iLines = 0;
FX_FLOAT fLinePos = 0;
CXFA_Node* pNode = NULL;
- CFX_SizeF szText;
- szText.Set(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
+ CFX_SizeF szText(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
int32_t iCount = m_Blocks.GetSize();
int32_t iBlocksHeightCount = m_pLoader->m_BlocksHeight.GetSize();
iBlocksHeightCount /= 2;
diff --git a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
index 71fc72ce5a..b9b37ad1e1 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
@@ -96,7 +96,7 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) {
CXFA_ContentLayoutItem* pLayoutItem =
m_pRootItemLayoutProcessor->ExtractLayoutItem();
if (pLayoutItem) {
- pLayoutItem->m_sPos.Set(fPosX, fPosY);
+ pLayoutItem->m_sPos = CFX_PointF(fPosX, fPosY);
}
m_pLayoutPageMgr->SubmitContentItem(pLayoutItem, eStatus);
} while (eStatus != XFA_ItemLayoutProcessorResult_Done &&
@@ -186,15 +186,16 @@ int32_t CXFA_ContainerLayoutItem::GetPageIndex() const {
->GetPageIndex(this);
}
void CXFA_ContainerLayoutItem::GetPageSize(CFX_SizeF& size) {
- size.Set(0, 0);
+ size.clear();
CXFA_Node* pMedium = m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Medium);
- if (pMedium) {
- size.x = pMedium->GetMeasure(XFA_ATTRIBUTE_Short).ToUnit(XFA_UNIT_Pt);
- size.y = pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt);
- if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) ==
- XFA_ATTRIBUTEENUM_Landscape) {
- size.Set(size.y, size.x);
- }
+ if (!pMedium)
+ return;
+
+ size = CFX_SizeF(pMedium->GetMeasure(XFA_ATTRIBUTE_Short).ToUnit(XFA_UNIT_Pt),
+ pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt));
+ if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) ==
+ XFA_ATTRIBUTEENUM_Landscape) {
+ size = CFX_SizeF(size.y, size.x);
}
}
CXFA_Node* CXFA_ContainerLayoutItem::GetMasterPage() const {
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
index be29f8322e..4627c4c555 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
@@ -391,17 +391,18 @@ void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const {
if (CXFA_Node* pMarginNode =
pLayoutItem->m_pFormNode->GetFirstChildByClass(
XFA_ELEMENT_Margin)) {
- sPos.Add(pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset)
- .ToUnit(XFA_UNIT_Pt),
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset)
- .ToUnit(XFA_UNIT_Pt));
+ sPos += CFX_PointF(pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset)
+ .ToUnit(XFA_UNIT_Pt),
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset)
+ .ToUnit(XFA_UNIT_Pt));
}
} else {
if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_ContentArea) {
- sPos.Add(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X)
- .ToUnit(XFA_UNIT_Pt),
- pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y)
- .ToUnit(XFA_UNIT_Pt));
+ sPos +=
+ CFX_PointF(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X)
+ .ToUnit(XFA_UNIT_Pt),
+ pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y)
+ .ToUnit(XFA_UNIT_Pt));
break;
} else if (pLayoutItem->m_pFormNode->GetClassID() ==
XFA_ELEMENT_PageArea) {
@@ -1283,7 +1284,7 @@ static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells(
if (nOriginalColSpan == -1) {
bMetWholeRowCell = TRUE;
}
- pLayoutChild->m_sPos.Set(fCurrentColX, 0);
+ pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0);
pLayoutChild->m_sSize.x = fColSpanWidth;
if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) {
fCurrentColX += fColSpanWidth;
@@ -1364,7 +1365,7 @@ static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells(
pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight,
fContainerHeight);
- pLayoutRow->m_sSize.Set(fContainerWidth, fContainerHeight);
+ pLayoutRow->m_sSize = CFX_SizeF(fContainerWidth, fContainerHeight);
}
void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
if (m_pLayoutItem)
@@ -1762,10 +1763,10 @@ static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems(
if (pProcessor->m_PendingNodes.empty()) {
return fTotalHeight;
}
- if (pProcessor->m_pLayoutItem == NULL) {
+ if (!pProcessor->m_pLayoutItem) {
pProcessor->m_pLayoutItem =
pProcessor->CreateContentLayoutItem(pCurChildNode);
- pProcessor->m_pLayoutItem->m_sSize.Set(0, 0);
+ pProcessor->m_pLayoutItem->m_sSize.clear();
}
while (!pProcessor->m_PendingNodes.empty()) {
std::unique_ptr<CXFA_ItemLayoutProcessor> pPendingProcessor(
@@ -1793,9 +1794,9 @@ static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems(
FX_FLOAT CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() {
FX_FLOAT fTotalHeight = 0;
if (m_arrayKeepItems.GetSize()) {
- if (m_pLayoutItem == NULL) {
+ if (!m_pLayoutItem) {
m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- m_pLayoutItem->m_sSize.Set(0, 0);
+ m_pLayoutItem->m_sSize.clear();
}
for (int32_t iIndex = m_arrayKeepItems.GetSize() - 1; iIndex >= 0;
iIndex--) {
@@ -2787,9 +2788,10 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
rgCurLineLayoutItems[0][j]->m_sSize.x,
rgCurLineLayoutItems[0][j]->m_sSize.y,
fAbsoluteX, fAbsoluteY);
- rgCurLineLayoutItems[0][j]->m_sPos.Set(fAbsoluteX, fAbsoluteY);
+ rgCurLineLayoutItems[0][j]->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY);
} else {
- rgCurLineLayoutItems[0][j]->m_sPos.Set(fCurPos, fContentCurRowY);
+ rgCurLineLayoutItems[0][j]->m_sPos =
+ CFX_PointF(fCurPos, fContentCurRowY);
if (XFA_ItemLayoutProcessor_IsTakingSpace(
rgCurLineLayoutItems[0][j]->m_pFormNode)) {
fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.x;
@@ -2808,9 +2810,10 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
rgCurLineLayoutItems[1][j]->m_sSize.x,
rgCurLineLayoutItems[1][j]->m_sSize.y,
fAbsoluteX, fAbsoluteY);
- rgCurLineLayoutItems[1][j]->m_sPos.Set(fAbsoluteX, fAbsoluteY);
+ rgCurLineLayoutItems[1][j]->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY);
} else {
- rgCurLineLayoutItems[1][j]->m_sPos.Set(fCurPos, fContentCurRowY);
+ rgCurLineLayoutItems[1][j]->m_sPos =
+ CFX_PointF(fCurPos, fContentCurRowY);
if (XFA_ItemLayoutProcessor_IsTakingSpace(
rgCurLineLayoutItems[1][j]->m_pFormNode)) {
fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.x;
@@ -2827,9 +2830,10 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
rgCurLineLayoutItems[2][j]->m_sSize.x,
rgCurLineLayoutItems[2][j]->m_sSize.y,
fAbsoluteX, fAbsoluteY);
- rgCurLineLayoutItems[2][j]->m_sPos.Set(fAbsoluteX, fAbsoluteY);
+ rgCurLineLayoutItems[2][j]->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY);
} else {
- rgCurLineLayoutItems[2][j]->m_sPos.Set(fCurPos, fContentCurRowY);
+ rgCurLineLayoutItems[2][j]->m_sPos =
+ CFX_PointF(fCurPos, fContentCurRowY);
if (XFA_ItemLayoutProcessor_IsTakingSpace(
rgCurLineLayoutItems[2][j]->m_pFormNode)) {
fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.x;
@@ -2846,7 +2850,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
rgCurLineLayoutItems[0][j]->m_pFormNode)) {
fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.x;
}
- rgCurLineLayoutItems[0][j]->m_sPos.Set(fCurPos, fContentCurRowY);
+ rgCurLineLayoutItems[0][j]->m_sPos = CFX_PointF(fCurPos, fContentCurRowY);
m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]);
m_fLastRowWidth = fCurPos;
}
@@ -2858,7 +2862,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
rgCurLineLayoutItems[1][j]->m_pFormNode)) {
fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.x;
}
- rgCurLineLayoutItems[1][j]->m_sPos.Set(fCurPos, fContentCurRowY);
+ rgCurLineLayoutItems[1][j]->m_sPos = CFX_PointF(fCurPos, fContentCurRowY);
m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]);
m_fLastRowWidth = fCurPos;
}
@@ -2868,7 +2872,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
rgCurLineLayoutItems[2][j]->m_pFormNode)) {
fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.x;
}
- rgCurLineLayoutItems[2][j]->m_sPos.Set(fCurPos, fContentCurRowY);
+ rgCurLineLayoutItems[2][j]->m_sPos = CFX_PointF(fCurPos, fContentCurRowY);
m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]);
m_fLastRowWidth = fCurPos;
}
@@ -2990,13 +2994,11 @@ void CXFA_ItemLayoutProcessor::GetCurrentComponentSize(FX_FLOAT& fWidth,
}
void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(FX_FLOAT fAbsoluteX,
FX_FLOAT fAbsoluteY) {
- ASSERT(m_pLayoutItem);
- m_pLayoutItem->m_sPos.Set(fAbsoluteX, fAbsoluteY);
+ m_pLayoutItem->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY);
}
void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(FX_FLOAT fWidth,
FX_FLOAT fHeight) {
- ASSERT(m_pLayoutItem);
- m_pLayoutItem->m_sSize.Set(fWidth, fHeight);
+ m_pLayoutItem->m_sSize = CFX_SizeF(fWidth, fHeight);
}
FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
CXFA_Node* pFormNode) {