summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fsdk_baseform.h4
-rw-r--r--fpdfsdk/include/fsdk_define.h1
-rw-r--r--fpdfsdk/src/fpdfsave.cpp1
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp60
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_FontMap.cpp48
5 files changed, 23 insertions, 91 deletions
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index 0ee99ce5e4..023ea74148 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -281,10 +281,6 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
void XfaSetValidationsEnabled(FX_BOOL bEnabled);
#endif // PDF_ENABLE_XFA
-#ifdef _WIN32
- CPDF_Stream* LoadImageFromFile(const CFX_WideString& sFile);
-#endif
-
void OnKeyStrokeCommit(CPDF_FormField* pFormField,
CFX_WideString& csValue,
FX_BOOL& bRC);
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index c47839b1fd..708e8174a2 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -11,7 +11,6 @@
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_parser.h"
#include "core/include/fpdfapi/fpdf_render.h"
-#include "core/include/fpdfapi/fpdf_serial.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/include/fpdfdoc/fpdf_vt.h"
#include "core/include/fxge/fx_ge.h"
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 87545472f2..c1d21c8f72 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -6,6 +6,7 @@
#include "public/fpdf_save.h"
+#include "core/include/fpdfapi/fpdf_serial.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "public/fpdf_edit.h"
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 2f0fb42928..66e843473d 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -2189,66 +2189,6 @@ void CPDFSDK_InterForm::XfaSetValidationsEnabled(FX_BOOL bEnabled) {
}
#endif // PDF_ENABLE_XFA
-#ifdef _WIN32
-CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) {
- CPDF_Document* pDocument = m_pDocument->GetPDFDocument();
- CPDF_Stream* pRetStream = NULL;
-
- if (CFX_DIBitmap* pBmp = CFX_WindowsDIB::LoadFromFile(sFile.c_str())) {
- int nWidth = pBmp->GetWidth();
- int nHeight = pBmp->GetHeight();
-
- CPDF_Image Image(pDocument);
- Image.SetImage(pBmp, FALSE);
- CPDF_Stream* pImageStream = Image.GetStream();
- if (pImageStream) {
- if (pImageStream->GetObjNum() == 0)
- pDocument->AddIndirectObject(pImageStream);
-
- CPDF_Dictionary* pStreamDict = new CPDF_Dictionary();
- pStreamDict->SetAtName("Subtype", "Form");
- pStreamDict->SetAtName("Name", "IMG");
- CPDF_Array* pMatrix = new CPDF_Array();
- pStreamDict->SetAt("Matrix", pMatrix);
- pMatrix->AddInteger(1);
- pMatrix->AddInteger(0);
- pMatrix->AddInteger(0);
- pMatrix->AddInteger(1);
- pMatrix->AddInteger(-nWidth / 2);
- pMatrix->AddInteger(-nHeight / 2);
- CPDF_Dictionary* pResource = new CPDF_Dictionary();
- pStreamDict->SetAt("Resources", pResource);
- CPDF_Dictionary* pXObject = new CPDF_Dictionary();
- pResource->SetAt("XObject", pXObject);
- pXObject->SetAtReference("Img", pDocument, pImageStream);
- CPDF_Array* pProcSet = new CPDF_Array();
- pResource->SetAt("ProcSet", pProcSet);
- pProcSet->AddName("PDF");
- pProcSet->AddName("ImageC");
- pStreamDict->SetAtName("Type", "XObject");
- CPDF_Array* pBBox = new CPDF_Array();
- pStreamDict->SetAt("BBox", pBBox);
- pBBox->AddInteger(0);
- pBBox->AddInteger(0);
- pBBox->AddInteger(nWidth);
- pBBox->AddInteger(nHeight);
- pStreamDict->SetAtInteger("FormType", 1);
-
- pRetStream = new CPDF_Stream(NULL, 0, NULL);
- CFX_ByteString csStream;
- csStream.Format("q\n%d 0 0 %d 0 0 cm\n/Img Do\nQ", nWidth, nHeight);
- pRetStream->InitStream((uint8_t*)csStream.c_str(), csStream.GetLength(),
- pStreamDict);
- pDocument->AddIndirectObject(pRetStream);
- }
-
- delete pBmp;
- }
-
- return pRetStream;
-}
-#endif // _WIN32
-
void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) {
CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
ASSERT(pEnv);
diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
index e418e8b380..89a75b2854 100644
--- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
@@ -9,7 +9,26 @@
#include "core/include/fpdfapi/fpdf_module.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-#define DEFAULT_FONT_NAME "Helvetica"
+namespace {
+
+const char kDefaultFontName[] = "Helvetica";
+
+const char* const g_sDEStandardFontName[] = {"Courier",
+ "Courier-Bold",
+ "Courier-BoldOblique",
+ "Courier-Oblique",
+ "Helvetica",
+ "Helvetica-Bold",
+ "Helvetica-BoldOblique",
+ "Helvetica-Oblique",
+ "Times-Roman",
+ "Times-Bold",
+ "Times-Italic",
+ "Times-BoldItalic",
+ "Symbol",
+ "ZapfDingbats"};
+
+} // namespace
CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler)
: m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) {
@@ -151,34 +170,11 @@ void CPWL_FontMap::Empty() {
}
void CPWL_FontMap::Initialize() {
- GetFontIndex(DEFAULT_FONT_NAME, ANSI_CHARSET, FALSE);
+ GetFontIndex(kDefaultFontName, ANSI_CHARSET, FALSE);
}
-/*
-List of currently supported standard fonts:
-Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique
-Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique
-Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
-Symbol, ZapfDingbats
-*/
-
-const char* g_sDEStandardFontName[] = {"Courier",
- "Courier-Bold",
- "Courier-BoldOblique",
- "Courier-Oblique",
- "Helvetica",
- "Helvetica-Bold",
- "Helvetica-BoldOblique",
- "Helvetica-Oblique",
- "Times-Roman",
- "Times-Bold",
- "Times-Italic",
- "Times-BoldItalic",
- "Symbol",
- "ZapfDingbats"};
-
FX_BOOL CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) {
- for (int32_t i = 0; i < 14; i++) {
+ for (int32_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) {
if (sFontName == g_sDEStandardFontName[i])
return TRUE;
}