summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/Field.cpp60
-rw-r--r--fpdfsdk/javascript/Field.h12
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp4
-rw-r--r--fpdfsdk/javascript/color.cpp46
-rw-r--r--fpdfsdk/javascript/color.h32
5 files changed, 76 insertions, 78 deletions
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 8e4b465d5e..32d44774ff 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -1436,7 +1436,7 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
vp >> crArray;
- CPWL_Color color;
+ CFX_Color color;
color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
if (m_bDelay) {
AddDelay_Color(FP_FILLCOLOR, color);
@@ -1455,23 +1455,23 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
int iColorType;
pFormControl->GetBackgroundColor(iColorType);
- CPWL_Color color;
+ CFX_Color color;
if (iColorType == COLORTYPE_TRANSPARENT) {
- color = CPWL_Color(COLORTYPE_TRANSPARENT);
+ color = CFX_Color(COLORTYPE_TRANSPARENT);
} else if (iColorType == COLORTYPE_GRAY) {
color =
- CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBackgroundColor(0));
+ CFX_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBackgroundColor(0));
} else if (iColorType == COLORTYPE_RGB) {
color =
- CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBackgroundColor(0),
- pFormControl->GetOriginalBackgroundColor(1),
- pFormControl->GetOriginalBackgroundColor(2));
+ CFX_Color(COLORTYPE_RGB, pFormControl->GetOriginalBackgroundColor(0),
+ pFormControl->GetOriginalBackgroundColor(1),
+ pFormControl->GetOriginalBackgroundColor(2));
} else if (iColorType == COLORTYPE_CMYK) {
color =
- CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBackgroundColor(0),
- pFormControl->GetOriginalBackgroundColor(1),
- pFormControl->GetOriginalBackgroundColor(2),
- pFormControl->GetOriginalBackgroundColor(3));
+ CFX_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBackgroundColor(0),
+ pFormControl->GetOriginalBackgroundColor(1),
+ pFormControl->GetOriginalBackgroundColor(2),
+ pFormControl->GetOriginalBackgroundColor(3));
} else {
return false;
}
@@ -1483,7 +1483,7 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
// Not supported.
}
@@ -2213,7 +2213,7 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
vp >> crArray;
- CPWL_Color color;
+ CFX_Color color;
color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
if (m_bDelay) {
AddDelay_Color(FP_STROKECOLOR, color);
@@ -2235,20 +2235,20 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
int iColorType;
pFormControl->GetBorderColor(iColorType);
- CPWL_Color color;
+ CFX_Color color;
if (iColorType == COLORTYPE_TRANSPARENT) {
- color = CPWL_Color(COLORTYPE_TRANSPARENT);
+ color = CFX_Color(COLORTYPE_TRANSPARENT);
} else if (iColorType == COLORTYPE_GRAY) {
- color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBorderColor(0));
+ color = CFX_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBorderColor(0));
} else if (iColorType == COLORTYPE_RGB) {
- color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBorderColor(0),
- pFormControl->GetOriginalBorderColor(1),
- pFormControl->GetOriginalBorderColor(2));
+ color = CFX_Color(COLORTYPE_RGB, pFormControl->GetOriginalBorderColor(0),
+ pFormControl->GetOriginalBorderColor(1),
+ pFormControl->GetOriginalBorderColor(2));
} else if (iColorType == COLORTYPE_CMYK) {
- color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBorderColor(0),
- pFormControl->GetOriginalBorderColor(1),
- pFormControl->GetOriginalBorderColor(2),
- pFormControl->GetOriginalBorderColor(3));
+ color = CFX_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBorderColor(0),
+ pFormControl->GetOriginalBorderColor(1),
+ pFormControl->GetOriginalBorderColor(2),
+ pFormControl->GetOriginalBorderColor(3));
} else {
return false;
}
@@ -2261,7 +2261,7 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
// Not supported.
}
@@ -2353,7 +2353,7 @@ bool Field::textColor(CJS_Runtime* pRuntime,
vp >> crArray;
- CPWL_Color color;
+ CFX_Color color;
color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
if (m_bDelay) {
AddDelay_Color(FP_TEXTCOLOR, color);
@@ -2383,11 +2383,11 @@ bool Field::textColor(CJS_Runtime* pRuntime,
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- CPWL_Color crRet =
- CPWL_Color(COLORTYPE_RGB, r / 255.0f, g / 255.0f, b / 255.0f);
+ CFX_Color crRet =
+ CFX_Color(COLORTYPE_RGB, r / 255.0f, g / 255.0f, b / 255.0f);
if (iColorType == COLORTYPE_TRANSPARENT)
- crRet = CPWL_Color(COLORTYPE_TRANSPARENT);
+ crRet = CFX_Color(COLORTYPE_TRANSPARENT);
color::ConvertPWLColorToArray(pRuntime, crRet, &crArray);
vp << crArray;
@@ -2397,7 +2397,7 @@ bool Field::textColor(CJS_Runtime* pRuntime,
void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
// Not supported.
}
@@ -3231,7 +3231,7 @@ void Field::AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect) {
m_pJSDoc->AddDelayData(pNewData);
}
-void Field::AddDelay_Color(FIELD_PROP prop, const CPWL_Color& color) {
+void Field::AddDelay_Color(FIELD_PROP prop, const CFX_Color& color) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->color = color;
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index 688c5de9f4..1c8d6beac1 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -11,9 +11,9 @@
#include <vector>
#include "core/fxcrt/cfx_observable.h"
+#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/javascript/JS_Define.h"
-#include "fpdfsdk/pdfwindow/cpwl_wnd.h" // For CPWL_Color.
class CPDFSDK_Widget;
class Document;
@@ -67,7 +67,7 @@ struct CJS_DelayData {
CFX_ByteString string;
CFX_WideString widestring;
CFX_FloatRect rect;
- CPWL_Color color;
+ CFX_Color color;
std::vector<uint32_t> wordarray;
std::vector<CFX_WideString> widestringarray;
};
@@ -385,7 +385,7 @@ class Field : public CJS_EmbedObj {
static void SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color);
+ const CFX_Color& color);
static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
@@ -421,7 +421,7 @@ class Field : public CJS_EmbedObj {
static void SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color);
+ const CFX_Color& color);
static void SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
@@ -429,7 +429,7 @@ class Field : public CJS_EmbedObj {
static void SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color);
+ const CFX_Color& color);
static void SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
@@ -490,7 +490,7 @@ class Field : public CJS_EmbedObj {
void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string);
void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string);
void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
- void AddDelay_Color(FIELD_PROP prop, const CPWL_Color& color);
+ void AddDelay_Color(FIELD_PROP prop, const CFX_Color& color);
void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
void AddDelay_WideStringArray(FIELD_PROP prop,
const std::vector<CFX_WideString>& array);
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 2efcacdde9..bdae064cea 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -875,8 +875,8 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
CJS_Array aProp;
vProp.GetJSValue()->ConvertToArray(pRuntime, aProp);
- CPWL_Color crProp;
- CPWL_Color crColor;
+ CFX_Color crProp;
+ CFX_Color crColor;
color::ConvertArrayToPWLColor(pRuntime, aProp, &crProp);
color::ConvertArrayToPWLColor(pRuntime, arColor, &crColor);
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 376eefa248..7bf3cc9c6f 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -39,24 +39,24 @@ JSMethodSpec CJS_Color::MethodSpecs[] = {{"convert", convert_static},
IMPLEMENT_JS_CLASS(CJS_Color, color)
color::color(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {
- m_crTransparent = CPWL_Color(COLORTYPE_TRANSPARENT);
- m_crBlack = CPWL_Color(COLORTYPE_GRAY, 0);
- m_crWhite = CPWL_Color(COLORTYPE_GRAY, 1);
- m_crRed = CPWL_Color(COLORTYPE_RGB, 1, 0, 0);
- m_crGreen = CPWL_Color(COLORTYPE_RGB, 0, 1, 0);
- m_crBlue = CPWL_Color(COLORTYPE_RGB, 0, 0, 1);
- m_crCyan = CPWL_Color(COLORTYPE_CMYK, 1, 0, 0, 0);
- m_crMagenta = CPWL_Color(COLORTYPE_CMYK, 0, 1, 0, 0);
- m_crYellow = CPWL_Color(COLORTYPE_CMYK, 0, 0, 1, 0);
- m_crDKGray = CPWL_Color(COLORTYPE_GRAY, 0.25);
- m_crGray = CPWL_Color(COLORTYPE_GRAY, 0.5);
- m_crLTGray = CPWL_Color(COLORTYPE_GRAY, 0.75);
+ m_crTransparent = CFX_Color(COLORTYPE_TRANSPARENT);
+ m_crBlack = CFX_Color(COLORTYPE_GRAY, 0);
+ m_crWhite = CFX_Color(COLORTYPE_GRAY, 1);
+ m_crRed = CFX_Color(COLORTYPE_RGB, 1, 0, 0);
+ m_crGreen = CFX_Color(COLORTYPE_RGB, 0, 1, 0);
+ m_crBlue = CFX_Color(COLORTYPE_RGB, 0, 0, 1);
+ m_crCyan = CFX_Color(COLORTYPE_CMYK, 1, 0, 0, 0);
+ m_crMagenta = CFX_Color(COLORTYPE_CMYK, 0, 1, 0, 0);
+ m_crYellow = CFX_Color(COLORTYPE_CMYK, 0, 0, 1, 0);
+ m_crDKGray = CFX_Color(COLORTYPE_GRAY, 0.25);
+ m_crGray = CFX_Color(COLORTYPE_GRAY, 0.5);
+ m_crLTGray = CFX_Color(COLORTYPE_GRAY, 0.75);
}
color::~color() {}
void color::ConvertPWLColorToArray(CJS_Runtime* pRuntime,
- const CPWL_Color& color,
+ const CFX_Color& color,
CJS_Array* array) {
switch (color.nColorType) {
case COLORTYPE_TRANSPARENT:
@@ -84,7 +84,7 @@ void color::ConvertPWLColorToArray(CJS_Runtime* pRuntime,
void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
const CJS_Array& array,
- CPWL_Color* color) {
+ CFX_Color* color) {
int nArrayLen = array.GetLength(pRuntime);
if (nArrayLen < 1)
return;
@@ -119,14 +119,14 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
}
if (sSpace == "T") {
- *color = CPWL_Color(COLORTYPE_TRANSPARENT);
+ *color = CFX_Color(COLORTYPE_TRANSPARENT);
} else if (sSpace == "G") {
- *color = CPWL_Color(COLORTYPE_GRAY, (float)d1);
+ *color = CFX_Color(COLORTYPE_GRAY, (float)d1);
} else if (sSpace == "RGB") {
- *color = CPWL_Color(COLORTYPE_RGB, (float)d1, (float)d2, (float)d3);
+ *color = CFX_Color(COLORTYPE_RGB, (float)d1, (float)d2, (float)d3);
} else if (sSpace == "CMYK") {
*color =
- CPWL_Color(COLORTYPE_CMYK, (float)d1, (float)d2, (float)d3, (float)d4);
+ CFX_Color(COLORTYPE_CMYK, (float)d1, (float)d2, (float)d3, (float)d4);
}
}
@@ -204,7 +204,7 @@ bool color::ltGray(CJS_Runtime* pRuntime,
bool color::PropertyHelper(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CPWL_Color* var) {
+ CFX_Color* var) {
CJS_Array array;
if (vp.IsGetting()) {
ConvertPWLColorToArray(pRuntime, *var, &array);
@@ -230,7 +230,7 @@ bool color::convert(CJS_Runtime* pRuntime,
if (!params[0].ConvertToArray(pRuntime, aSource))
return false;
- CPWL_Color crSource;
+ CFX_Color crSource;
ConvertArrayToPWLColor(pRuntime, aSource, &crSource);
CFX_ByteString sDestSpace = params[1].ToCFXByteString(pRuntime);
@@ -247,7 +247,7 @@ bool color::convert(CJS_Runtime* pRuntime,
}
CJS_Array aDest;
- CPWL_Color crDest = crSource.ConvertColorType(nColorType);
+ CFX_Color crDest = crSource.ConvertColorType(nColorType);
ConvertPWLColorToArray(pRuntime, crDest, &aDest);
vRet = CJS_Value(pRuntime, aDest);
@@ -268,8 +268,8 @@ bool color::equal(CJS_Runtime* pRuntime,
if (!params[1].ConvertToArray(pRuntime, array2))
return false;
- CPWL_Color color1;
- CPWL_Color color2;
+ CFX_Color color1;
+ CFX_Color color2;
ConvertArrayToPWLColor(pRuntime, array1, &color1);
ConvertArrayToPWLColor(pRuntime, array2, &color2);
color1 = color1.ConvertColorType(color2.nColorType);
diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h
index 3e03dec730..e67d4d5ad5 100644
--- a/fpdfsdk/javascript/color.h
+++ b/fpdfsdk/javascript/color.h
@@ -44,29 +44,27 @@ class color : public CJS_EmbedObj {
CFX_WideString& sError);
static void ConvertPWLColorToArray(CJS_Runtime* pRuntime,
- const CPWL_Color& color,
+ const CFX_Color& color,
CJS_Array* array);
static void ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
const CJS_Array& array,
- CPWL_Color* color);
+ CFX_Color* color);
private:
- bool PropertyHelper(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CPWL_Color* val);
+ bool PropertyHelper(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_Color* val);
- CPWL_Color m_crTransparent;
- CPWL_Color m_crBlack;
- CPWL_Color m_crWhite;
- CPWL_Color m_crRed;
- CPWL_Color m_crGreen;
- CPWL_Color m_crBlue;
- CPWL_Color m_crCyan;
- CPWL_Color m_crMagenta;
- CPWL_Color m_crYellow;
- CPWL_Color m_crDKGray;
- CPWL_Color m_crGray;
- CPWL_Color m_crLTGray;
+ CFX_Color m_crTransparent;
+ CFX_Color m_crBlack;
+ CFX_Color m_crWhite;
+ CFX_Color m_crRed;
+ CFX_Color m_crGreen;
+ CFX_Color m_crBlue;
+ CFX_Color m_crCyan;
+ CFX_Color m_crMagenta;
+ CFX_Color m_crYellow;
+ CFX_Color m_crDKGray;
+ CFX_Color m_crGray;
+ CFX_Color m_crLTGray;
};
class CJS_Color : public CJS_Object {