diff options
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r-- | core/fpdfdoc/cpvt_generateap.cpp | 27 | ||||
-rw-r--r-- | core/fpdfdoc/cpvt_generateap.h | 11 | ||||
-rw-r--r-- | core/fpdfdoc/include/fpdf_doc.h | 2 |
3 files changed, 18 insertions, 22 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index adaee6363e..aa49f79c12 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -107,7 +107,8 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, rcAnnot.right - rcAnnot.left); break; } - int32_t nBorderStyle = PBS_SOLID; + + BorderStyle nBorderStyle = BorderStyle::SOLID; FX_FLOAT fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; @@ -121,25 +122,25 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } switch (pBSDict->GetStringBy("S").GetAt(0)) { case 'S': - nBorderStyle = PBS_SOLID; + nBorderStyle = BorderStyle::SOLID; break; case 'D': - nBorderStyle = PBS_DASH; + nBorderStyle = BorderStyle::DASH; break; case 'B': - nBorderStyle = PBS_BEVELED; + nBorderStyle = BorderStyle::BEVELED; fBorderWidth *= 2; crLeftTop = CPVT_Color(CPVT_Color::kGray, 1); crRightBottom = CPVT_Color(CPVT_Color::kGray, 0.5); break; case 'I': - nBorderStyle = PBS_INSET; + nBorderStyle = BorderStyle::INSET; fBorderWidth *= 2; crLeftTop = CPVT_Color(CPVT_Color::kGray, 0.5); crRightBottom = CPVT_Color(CPVT_Color::kGray, 0.75); break; case 'U': - nBorderStyle = PBS_UNDERLINED; + nBorderStyle = BorderStyle::UNDERLINE; break; } } @@ -318,7 +319,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CFX_ByteString sButtonBorder = CPVT_GenerateAP::GenerateBorderAP( rcButton, 2, CPVT_Color(CPVT_Color::kGray, 0), CPVT_Color(CPVT_Color::kGray, 1), - CPVT_Color(CPVT_Color::kGray, 0.5), PBS_BEVELED, + CPVT_Color(CPVT_Color::kGray, 0.5), BorderStyle::BEVELED, CPVT_Dash(3, 0, 0)); if (sButtonBorder.GetLength() > 0) sAppStream << "q\n" << sButtonBorder << "Q\n"; @@ -589,7 +590,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( const CPVT_Color& color, const CPVT_Color& crLeftTop, const CPVT_Color& crRightBottom, - int32_t nStyle, + BorderStyle nStyle, const CPVT_Dash& dash) { CFX_ByteTextBuf sAppStream; CFX_ByteString sColor; @@ -601,7 +602,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( FX_FLOAT fHalfWidth = fWidth / 2.0f; switch (nStyle) { default: - case PBS_SOLID: + case BorderStyle::SOLID: sColor = GenerateColorAP(color, TRUE); if (sColor.GetLength() > 0) { sAppStream << sColor; @@ -613,7 +614,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( sAppStream << "f*\n"; } break; - case PBS_DASH: + case BorderStyle::DASH: sColor = GenerateColorAP(color, FALSE); if (sColor.GetLength() > 0) { sAppStream << sColor; @@ -632,8 +633,8 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( << " l S\n"; } break; - case PBS_BEVELED: - case PBS_INSET: + case BorderStyle::BEVELED: + case BorderStyle::INSET: sColor = GenerateColorAP(crLeftTop, TRUE); if (sColor.GetLength() > 0) { sAppStream << sColor; @@ -676,7 +677,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP( << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; } break; - case PBS_UNDERLINED: + case BorderStyle::UNDERLINE: sColor = GenerateColorAP(color, FALSE); if (sColor.GetLength() > 0) { sAppStream << sColor; diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h index 924de40ed4..1258643d3e 100644 --- a/core/fpdfdoc/cpvt_generateap.h +++ b/core/fpdfdoc/cpvt_generateap.h @@ -10,18 +10,11 @@ #include "core/fpdfdoc/cpvt_color.h" #include "core/fpdfdoc/cpvt_dash.h" #include "core/fpdfdoc/include/cpdf_variabletext.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -// border style -#define PBS_SOLID 0 -#define PBS_DASH 1 -#define PBS_BEVELED 2 -#define PBS_INSET 3 -#define PBS_UNDERLINED 4 -#define PBS_SHADOW 5 - class CPDF_Dictionary; class CPDF_Document; class IPVT_FontMap; @@ -48,7 +41,7 @@ class CPVT_GenerateAP { const CPVT_Color& color, const CPVT_Color& crLeftTop, const CPVT_Color& crRightBottom, - int32_t nStyle, + BorderStyle nStyle, const CPVT_Dash& dash); static CFX_ByteString GenerateColorAP(const CPVT_Color& color, const FX_BOOL& bFillOrStroke); diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h index d69887bd78..8758ab9a42 100644 --- a/core/fpdfdoc/include/fpdf_doc.h +++ b/core/fpdfdoc/include/fpdf_doc.h @@ -48,6 +48,8 @@ class CPDF_ViewerPreferences; class CXML_Element; class CFX_RenderDevice; +enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE }; + class CPDF_NameTree { public: explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} |