summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_ap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfdoc/doc_ap.cpp')
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp76
1 files changed, 37 insertions, 39 deletions
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index 7fe06e2b5d..3ccf4c44d1 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -327,33 +327,33 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (!pDefFont) {
return FALSE;
}
- CFX_FloatRect rcAnnot = pAnnotDict->GetRectBy("Rect");
+ CPDF_Rect rcAnnot = pAnnotDict->GetRectBy("Rect");
int32_t nRotate = 0;
if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) {
nRotate = pMKDict->GetIntegerBy("R");
}
- CFX_FloatRect rcBBox;
+ CPDF_Rect rcBBox;
CFX_Matrix matrix;
switch (nRotate % 360) {
case 0:
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.right - rcAnnot.left,
- rcAnnot.top - rcAnnot.bottom);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left,
+ rcAnnot.top - rcAnnot.bottom);
break;
case 90:
matrix = CFX_Matrix(0, 1, -1, 0, rcAnnot.right - rcAnnot.left, 0);
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.top - rcAnnot.bottom,
- rcAnnot.right - rcAnnot.left);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom,
+ rcAnnot.right - rcAnnot.left);
break;
case 180:
matrix = CFX_Matrix(-1, 0, 0, -1, rcAnnot.right - rcAnnot.left,
rcAnnot.top - rcAnnot.bottom);
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.right - rcAnnot.left,
- rcAnnot.top - rcAnnot.bottom);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left,
+ rcAnnot.top - rcAnnot.bottom);
break;
case 270:
matrix = CFX_Matrix(0, -1, 1, 0, 0, rcAnnot.top - rcAnnot.bottom);
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.top - rcAnnot.bottom,
- rcAnnot.right - rcAnnot.left);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom,
+ rcAnnot.right - rcAnnot.left);
break;
}
int32_t nBorderStyle = PBS_SOLID;
@@ -414,9 +414,9 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (sBorderStream.GetLength() > 0) {
sAppStream << "q\n" << sBorderStream << "Q\n";
}
- CFX_FloatRect rcBody =
- CFX_FloatRect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth,
- rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth);
+ CPDF_Rect rcBody =
+ CPDF_Rect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth,
+ rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth);
rcBody.Normalize();
CPDF_Dictionary* pAPDict = pAnnotDict->GetDictBy("AP");
if (!pAPDict) {
@@ -496,11 +496,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
vt.Initialize();
vt.SetText(swValue.c_str());
vt.RearrangeAll();
- CFX_FloatRect rcContent = vt.GetContentRect();
- CFX_FloatPoint ptOffset(0.0f, 0.0f);
+ CPDF_Rect rcContent = vt.GetContentRect();
+ CPDF_Point ptOffset(0.0f, 0.0f);
if (!bMultiLine) {
ptOffset =
- CFX_FloatPoint(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f);
+ CPDF_Point(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f);
}
CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP(
&map, vt.GetIterator(), ptOffset, !bCharArray, subWord);
@@ -529,10 +529,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CPVT_Provider prd(&map);
CPDF_VariableText vt;
vt.SetProvider(&prd);
- CFX_FloatRect rcButton = rcBody;
+ CPDF_Rect rcButton = rcBody;
rcButton.left = rcButton.right - 13;
rcButton.Normalize();
- CFX_FloatRect rcEdit = rcBody;
+ CPDF_Rect rcEdit = rcBody;
rcEdit.right = rcButton.left;
rcEdit.Normalize();
vt.SetPlateRect(rcEdit);
@@ -544,9 +544,9 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
vt.Initialize();
vt.SetText(swValue.c_str());
vt.RearrangeAll();
- CFX_FloatRect rcContent = vt.GetContentRect();
- CFX_FloatPoint ptOffset =
- CFX_FloatPoint(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
+ CPDF_Rect rcContent = vt.GetContentRect();
+ CPDF_Point ptOffset =
+ CPDF_Point(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(
&map, vt.GetIterator(), ptOffset, TRUE, 0);
if (sEdit.GetLength() > 0) {
@@ -575,9 +575,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (sButtonBorder.GetLength() > 0) {
sAppStream << "q\n" << sButtonBorder << "Q\n";
}
- CFX_FloatPoint ptCenter =
- CFX_FloatPoint((rcButton.left + rcButton.right) / 2,
- (rcButton.top + rcButton.bottom) / 2);
+ CPDF_Point ptCenter = CPDF_Point((rcButton.left + rcButton.right) / 2,
+ (rcButton.top + rcButton.bottom) / 2);
if (IsFloatBigger(rcButton.Width(), 6) &&
IsFloatBigger(rcButton.Height(), 6)) {
sAppStream << "q\n"
@@ -629,8 +628,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
}
CPDF_VariableText vt;
vt.SetProvider(&prd);
- vt.SetPlateRect(
- CFX_FloatRect(rcBody.left, 0.0f, rcBody.right, 0.0f));
+ vt.SetPlateRect(CPDF_Rect(rcBody.left, 0.0f, rcBody.right, 0.0f));
if (IsFloatZero(fFontSize)) {
vt.SetFontSize(12.0f);
} else {
@@ -641,8 +639,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
vt.RearrangeAll();
FX_FLOAT fItemHeight = vt.GetContentRect().Height();
if (bSelected) {
- CFX_FloatRect rcItem = CFX_FloatRect(
- rcBody.left, fy - fItemHeight, rcBody.right, fy);
+ CPDF_Rect rcItem =
+ CPDF_Rect(rcBody.left, fy - fItemHeight, rcBody.right, fy);
sBody << "q\n" << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 0,
51.0f / 255.0f, 113.0f / 255.0f),
@@ -653,13 +651,13 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kGray, 1), TRUE)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
- CFX_FloatPoint(0.0f, fy),
+ CPDF_Point(0.0f, fy),
TRUE, 0)
<< "ET\n";
} else {
sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
- CFX_FloatPoint(0.0f, fy),
+ CPDF_Point(0.0f, fy),
TRUE, 0)
<< "ET\n";
}
@@ -716,12 +714,12 @@ FX_BOOL CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc,
CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,
IPDF_VariableText_Iterator* pIterator,
- const CFX_FloatPoint& ptOffset,
+ const CPDF_Point& ptOffset,
FX_BOOL bContinuous,
FX_WORD SubWord,
const CPVT_WordRange* pVisible) {
CFX_ByteTextBuf sEditStream, sLineStream, sWords;
- CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
+ CPDF_Point ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
int32_t nCurFontIndex = -1;
if (pIterator) {
if (pVisible) {
@@ -745,13 +743,13 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
}
CPVT_Word word;
if (pIterator->GetWord(word)) {
- ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x,
- word.ptWord.y + ptOffset.y);
+ ptNew = CPDF_Point(word.ptWord.x + ptOffset.x,
+ word.ptWord.y + ptOffset.y);
} else {
CPVT_Line line;
pIterator->GetLine(line);
- ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x,
- line.ptLine.y + ptOffset.y);
+ ptNew = CPDF_Point(line.ptLine.x + ptOffset.x,
+ line.ptLine.y + ptOffset.y);
}
if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) {
sLineStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y
@@ -777,8 +775,8 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
} else {
CPVT_Word word;
if (pIterator->GetWord(word)) {
- ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x,
- word.ptWord.y + ptOffset.y);
+ ptNew = CPDF_Point(word.ptWord.x + ptOffset.x,
+ word.ptWord.y + ptOffset.y);
if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) {
sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y
<< " Td\n";
@@ -803,7 +801,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
return sEditStream.GetByteString();
}
CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
- const CFX_FloatRect& rect,
+ const CPDF_Rect& rect,
FX_FLOAT fWidth,
const CPVT_Color& color,
const CPVT_Color& crLeftTop,