summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_baseform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/fsdk_baseform.cpp')
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp83
1 files changed, 42 insertions, 41 deletions
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 1bae4dd5a1..0359c0bc9f 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -816,7 +816,7 @@ void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice,
!IsWidgetAppearanceValid(CPDF_Annot::Normal)) {
CFX_PathData pathData;
- CPDF_Rect rcAnnot = GetRect();
+ CFX_FloatRect rcAnnot = GetRect();
pathData.AppendRect(rcAnnot.left, rcAnnot.bottom, rcAnnot.right,
rcAnnot.top);
@@ -841,7 +841,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
CPDFSDK_PageView* pPageView) {
int nFieldType = GetFieldType();
if (m_pInterForm->IsNeedHighLight(nFieldType)) {
- CPDF_Rect rc = GetRect();
+ CFX_FloatRect rc = GetRect();
FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType);
uint8_t alpha = m_pInterForm->GetHighlightAlpha();
@@ -868,7 +868,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
void CPDFSDK_Widget::ResetAppearance_PushButton() {
CPDF_FormControl* pControl = GetFormControl();
- CPDF_Rect rcWindow = GetRotatedRect();
+ CFX_FloatRect rcWindow = GetRotatedRect();
int32_t nLayout = 0;
switch (pControl->GetTextPosition()) {
case TEXTPOS_ICON:
@@ -937,7 +937,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
}
- CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
CPWL_Color crText(COLORTYPE_GRAY, 0);
@@ -1125,8 +1125,8 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
break;
}
- CPDF_Rect rcWindow = GetRotatedRect();
- CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ CFX_FloatRect rcWindow = GetRotatedRect();
+ CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
@@ -1251,8 +1251,8 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
break;
}
- CPDF_Rect rcWindow = GetRotatedRect();
- CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ CFX_FloatRect rcWindow = GetRotatedRect();
+ CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
@@ -1290,7 +1290,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CFX_ByteString csAP_N_ON;
- CPDF_Rect rcCenter =
+ CFX_FloatRect rcCenter =
CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare(rcWindow), 1.0f);
if (nStyle == PCS_CIRCLE) {
@@ -1375,8 +1375,8 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
CPDF_FormField* pField = pControl->GetField();
CFX_ByteTextBuf sBody, sLines;
- CPDF_Rect rcClient = GetClientRect();
- CPDF_Rect rcButton = rcClient;
+ CFX_FloatRect rcClient = GetClientRect();
+ CFX_FloatRect rcButton = rcClient;
rcButton.left = rcButton.right - 13;
rcButton.Normalize();
@@ -1388,7 +1388,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
CBA_FontMap font_map(this, pEnv->GetSysHandler());
pEdit->SetFontMap(&font_map);
- CPDF_Rect rcEdit = rcClient;
+ CFX_FloatRect rcEdit = rcClient;
rcEdit.right = rcButton.left;
rcEdit.Normalize();
@@ -1414,10 +1414,10 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str());
}
- CPDF_Rect rcContent = pEdit->GetContentRect();
+ CFX_FloatRect rcContent = pEdit->GetContentRect();
CFX_ByteString sEdit =
- CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f, 0.0f));
+ CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
if (sEdit.GetLength() > 0) {
sBody << "/Tx BMC\n"
<< "q\n";
@@ -1447,7 +1447,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
void CPDFSDK_Widget::ResetAppearance_ListBox() {
CPDF_FormControl* pControl = GetFormControl();
CPDF_FormField* pField = pControl->GetField();
- CPDF_Rect rcClient = GetClientRect();
+ CFX_FloatRect rcClient = GetClientRect();
CFX_ByteTextBuf sBody, sLines;
if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) {
@@ -1459,7 +1459,8 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
CBA_FontMap font_map(this, pEnv->GetSysHandler());
pEdit->SetFontMap(&font_map);
- pEdit->SetPlateRect(CPDF_Rect(rcClient.left, 0.0f, rcClient.right, 0.0f));
+ pEdit->SetPlateRect(
+ CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f));
FX_FLOAT fFontSize = GetFontSize();
@@ -1488,12 +1489,12 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
pEdit->SetText(pField->GetOptionLabel(i).c_str());
- CPDF_Rect rcContent = pEdit->GetContentRect();
+ CFX_FloatRect rcContent = pEdit->GetContentRect();
FX_FLOAT fItemHeight = rcContent.Height();
if (bSelected) {
- CPDF_Rect rcItem =
- CPDF_Rect(rcClient.left, fy - fItemHeight, rcClient.right, fy);
+ CFX_FloatRect rcItem =
+ CFX_FloatRect(rcClient.left, fy - fItemHeight, rcClient.right, fy);
sList << "q\n" << CPWL_Utils::GetColorAppStream(
CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f,
113.0f / 255.0f),
@@ -1504,12 +1505,12 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
sList << "BT\n" << CPWL_Utils::GetColorAppStream(
CPWL_Color(COLORTYPE_GRAY, 1), TRUE)
- << CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f, fy))
+ << CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, fy))
<< "ET\n";
} else {
CPWL_Color crText = GetTextPWLColor();
sList << "BT\n" << CPWL_Utils::GetColorAppStream(crText, TRUE)
- << CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f, fy))
+ << CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, fy))
<< "ET\n";
}
@@ -1546,7 +1547,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
CBA_FontMap font_map(this, pEnv->GetSysHandler());
pEdit->SetFontMap(&font_map);
- CPDF_Rect rcClient = GetClientRect();
+ CFX_FloatRect rcClient = GetClientRect();
pEdit->SetPlateRect(rcClient);
pEdit->SetAlignmentH(pControl->GetControlAlignment());
@@ -1605,10 +1606,10 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
else
pEdit->SetText(pField->GetValue().c_str());
- CPDF_Rect rcContent = pEdit->GetContentRect();
+ CFX_FloatRect rcContent = pEdit->GetContentRect();
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(
- pEdit, CPDF_Point(0.0f, 0.0f), NULL, !bCharArray, subWord);
+ pEdit, CFX_FloatPoint(0.0f, 0.0f), NULL, !bCharArray, subWord);
if (sEdit.GetLength() > 0) {
sBody << "/Tx BMC\n"
@@ -1680,8 +1681,8 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP);
}
-CPDF_Rect CPDFSDK_Widget::GetClientRect() const {
- CPDF_Rect rcWindow = GetRotatedRect();
+CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
+ CFX_FloatRect rcWindow = GetRotatedRect();
FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
switch (GetBorderStyle()) {
case BBS_BEVELED:
@@ -1693,22 +1694,22 @@ CPDF_Rect CPDFSDK_Widget::GetClientRect() const {
return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
}
-CPDF_Rect CPDFSDK_Widget::GetRotatedRect() const {
- CPDF_Rect rectAnnot = GetRect();
+CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const {
+ CFX_FloatRect rectAnnot = GetRect();
FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
CPDF_FormControl* pControl = GetFormControl();
- CPDF_Rect rcPDFWindow;
+ CFX_FloatRect rcPDFWindow;
switch (abs(pControl->GetRotation() % 360)) {
case 0:
case 180:
default:
- rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight);
+ rcPDFWindow = CFX_FloatRect(0, 0, fWidth, fHeight);
break;
case 90:
case 270:
- rcPDFWindow = CPDF_Rect(0, 0, fHeight, fWidth);
+ rcPDFWindow = CFX_FloatRect(0, 0, fHeight, fWidth);
break;
}
@@ -1724,7 +1725,7 @@ CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const {
}
CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
- CPDF_Rect rcWindow = GetRotatedRect();
+ CFX_FloatRect rcWindow = GetRotatedRect();
CPWL_Color crBorder = GetBorderPWLColor();
CPWL_Color crBackground = GetFillPWLColor();
CPWL_Color crLeftTop, crRightBottom;
@@ -1766,7 +1767,7 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
CFX_Matrix CPDFSDK_Widget::GetMatrix() const {
CFX_Matrix mt;
CPDF_FormControl* pControl = GetFormControl();
- CPDF_Rect rcAnnot = GetRect();
+ CFX_FloatRect rcAnnot = GetRect();
FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left;
FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom;
@@ -2785,7 +2786,7 @@ void CBA_AnnotIterator::GenerateResults() {
int nLeftTopIndex = -1;
FX_FLOAT fTop = 0.0f;
for (int i = sa.size() - 1; i >= 0; i--) {
- CPDF_Rect rcAnnot = GetAnnotRect(sa[i]);
+ CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
if (rcAnnot.top > fTop) {
nLeftTopIndex = i;
fTop = rcAnnot.top;
@@ -2793,13 +2794,13 @@ void CBA_AnnotIterator::GenerateResults() {
}
if (nLeftTopIndex >= 0) {
CPDFSDK_Annot* pLeftTopAnnot = sa[nLeftTopIndex];
- CPDF_Rect rcLeftTop = GetAnnotRect(pLeftTopAnnot);
+ CFX_FloatRect rcLeftTop = GetAnnotRect(pLeftTopAnnot);
m_Annots.push_back(pLeftTopAnnot);
sa.erase(sa.begin() + nLeftTopIndex);
std::vector<int> aSelect;
for (int i = 0; i < sa.size(); ++i) {
- CPDF_Rect rcAnnot = GetAnnotRect(sa[i]);
+ CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
FX_FLOAT fCenterY = (rcAnnot.top + rcAnnot.bottom) / 2.0f;
if (fCenterY > rcLeftTop.bottom && fCenterY < rcLeftTop.top)
aSelect.push_back(i);
@@ -2825,7 +2826,7 @@ void CBA_AnnotIterator::GenerateResults() {
int nLeftTopIndex = -1;
FX_FLOAT fLeft = -1.0f;
for (int i = sa.size() - 1; i >= 0; --i) {
- CPDF_Rect rcAnnot = GetAnnotRect(sa[i]);
+ CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
if (fLeft < 0) {
nLeftTopIndex = 0;
fLeft = rcAnnot.left;
@@ -2837,13 +2838,13 @@ void CBA_AnnotIterator::GenerateResults() {
if (nLeftTopIndex >= 0) {
CPDFSDK_Annot* pLeftTopAnnot = sa[nLeftTopIndex];
- CPDF_Rect rcLeftTop = GetAnnotRect(pLeftTopAnnot);
+ CFX_FloatRect rcLeftTop = GetAnnotRect(pLeftTopAnnot);
m_Annots.push_back(pLeftTopAnnot);
sa.erase(sa.begin() + nLeftTopIndex);
std::vector<int> aSelect;
for (int i = 0; i < sa.size(); ++i) {
- CPDF_Rect rcAnnot = GetAnnotRect(sa[i]);
+ CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
FX_FLOAT fCenterX = (rcAnnot.left + rcAnnot.right) / 2.0f;
if (fCenterX > rcLeftTop.left && fCenterX < rcLeftTop.right)
aSelect.push_back(i);
@@ -2860,8 +2861,8 @@ void CBA_AnnotIterator::GenerateResults() {
}
}
-CPDF_Rect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
- CPDF_Rect rcAnnot;
+CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
+ CFX_FloatRect rcAnnot;
pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
return rcAnnot;
}