summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-27 12:47:01 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-27 12:47:01 -0700
commit303e525325904cd9b6a847f48951510e7dd8a45e (patch)
treedab3ff0e3bda317dc51ef0caf8d15daf88e7e6b8 /xfa/fxfa
parent43854a5073602a4613131aa6dbac5f7b9a095bcd (diff)
downloadpdfium-303e525325904cd9b6a847f48951510e7dd8a45e.tar.xz
More IFX_ interface cleanup.
Remove IFX_FontProvider, IFX_FontSourceEnum, IFX_SAXReader and IFX_SAXReaderHandler. Review-Url: https://codereview.chromium.org/1930533002
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_checksum.cpp21
-rw-r--r--xfa/fxfa/app/xfa_ffapp.cpp3
-rw-r--r--xfa/fxfa/app/xfa_fontmgr.cpp8
-rw-r--r--xfa/fxfa/include/xfa_checksum.h50
-rw-r--r--xfa/fxfa/include/xfa_ffapp.h2
-rw-r--r--xfa/fxfa/include/xfa_fontmgr.h3
6 files changed, 49 insertions, 38 deletions
diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp
index 59bf37b6a5..195033bfab 100644
--- a/xfa/fxfa/app/xfa_checksum.cpp
+++ b/xfa/fxfa/app/xfa_checksum.cpp
@@ -126,30 +126,28 @@ void CXFA_SAXReaderHandler::UpdateChecksum(FX_BOOL bCheckSpace) {
}
CXFA_ChecksumContext::CXFA_ChecksumContext()
- : m_pSAXReader(NULL), m_pByteContext(NULL) {}
+ : m_pSAXReader(nullptr), m_pByteContext(nullptr) {}
+
CXFA_ChecksumContext::~CXFA_ChecksumContext() {
FinishChecksum();
}
-FX_BOOL CXFA_ChecksumContext::StartChecksum() {
+
+void CXFA_ChecksumContext::StartChecksum() {
FinishChecksum();
m_pByteContext = FX_Alloc(uint8_t, 128);
CRYPT_SHA1Start(m_pByteContext);
m_bsChecksum.clear();
- m_pSAXReader = FX_SAXReader_Create();
- return m_pSAXReader != NULL;
+ m_pSAXReader = new CFX_SAXReader;
}
+
FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile,
FX_FILESIZE offset,
size_t size) {
- if (m_pSAXReader == NULL) {
- return FALSE;
- }
- if (pSrcFile == NULL) {
+ if (!m_pSAXReader || !pSrcFile)
return FALSE;
- }
- if (size < 1) {
+ if (size < 1)
size = pSrcFile->GetSize();
- }
+
CXFA_SAXReaderHandler handler(this);
m_pSAXReader->SetHandler(&handler);
if (m_pSAXReader->StartParse(
@@ -161,6 +159,7 @@ FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile,
}
return m_pSAXReader->ContinueParse(NULL) > 99;
}
+
void CXFA_ChecksumContext::FinishChecksum() {
if (m_pSAXReader) {
m_pSAXReader->Release();
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 71b8fc44b1..987b3e8efd 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "xfa/fgas/font/fgas_stdfontmgr.h"
#include "xfa/fwl/core/ifwl_widgetmgrdelegate.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
@@ -146,7 +147,7 @@ IFX_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
m_pFDEFontMgr = IFX_FontMgr::Create(FX_GetDefFontEnumerator());
#else
- m_pFontSource = FX_CreateDefaultFontSourceEnum();
+ m_pFontSource = new CFX_FontSourceEnum_File;
m_pFDEFontMgr = IFX_FontMgr::Create(m_pFontSource);
#endif
}
diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp
index 7c6d5cddec..69883674e5 100644
--- a/xfa/fxfa/app/xfa_fontmgr.cpp
+++ b/xfa/fxfa/app/xfa_fontmgr.cpp
@@ -1874,6 +1874,7 @@ IFX_Font* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName,
}
return NULL;
}
+
IFX_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily,
uint32_t dwFontStyles,
CPDF_Font** pPDFFont,
@@ -1894,6 +1895,7 @@ IFX_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily,
m_FontMap[strKey] = pFont;
return pFont;
}
+
CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName(
const CFX_ByteString& strPsName,
FX_BOOL bBold,
@@ -1907,6 +1909,7 @@ CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName(
}
return strPsName;
}
+
FX_BOOL CXFA_PDFFontMgr::PsNameMatchDRFontName(
const CFX_ByteStringC& bsPsName,
FX_BOOL bBold,
@@ -1996,10 +1999,13 @@ FX_BOOL CXFA_PDFFontMgr::GetCharWidth(IFX_Font* pFont,
iWidth = pPDFFont->GetCharWidthF(wUnicode);
return TRUE;
}
-CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(NULL) {}
+
+CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(nullptr) {}
+
CXFA_FontMgr::~CXFA_FontMgr() {
DelAllMgrMap();
}
+
IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc,
const CFX_WideStringC& wsFontFamily,
uint32_t dwFontStyles,
diff --git a/xfa/fxfa/include/xfa_checksum.h b/xfa/fxfa/include/xfa_checksum.h
index 6c24b2a5af..6c7ea7a04c 100644
--- a/xfa/fxfa/include/xfa_checksum.h
+++ b/xfa/fxfa/include/xfa_checksum.h
@@ -16,37 +16,41 @@ class CXFA_ChecksumContext;
class CXFA_SAXContext {
public:
CXFA_SAXContext() : m_eNode(FX_SAXNODE_Unknown) {}
+
CFX_ByteTextBuf m_TextBuf;
CFX_ByteString m_bsTagName;
FX_SAXNODE m_eNode;
};
-class CXFA_SAXReaderHandler : public IFX_SAXReaderHandler {
+
+class CXFA_SAXReaderHandler {
public:
CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext);
- virtual ~CXFA_SAXReaderHandler();
- virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName,
- FX_SAXNODE eType,
- uint32_t dwStartPos);
- virtual void OnTagAttribute(void* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue);
- virtual void OnTagBreak(void* pTag);
- virtual void OnTagData(void* pTag,
- FX_SAXNODE eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos);
- virtual void OnTagClose(void* pTag, uint32_t dwEndPos);
- virtual void OnTagEnd(void* pTag,
- const CFX_ByteStringC& bsTagName,
- uint32_t dwEndPos);
+ ~CXFA_SAXReaderHandler();
- virtual void OnTargetData(void* pTag,
- FX_SAXNODE eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos);
+ void* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ FX_SAXNODE eType,
+ uint32_t dwStartPos);
+ void OnTagAttribute(void* pTag,
+ const CFX_ByteStringC& bsAttri,
+ const CFX_ByteStringC& bsValue);
+ void OnTagBreak(void* pTag);
+ void OnTagData(void* pTag,
+ FX_SAXNODE eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+ void OnTagClose(void* pTag, uint32_t dwEndPos);
+ void OnTagEnd(void* pTag,
+ const CFX_ByteStringC& bsTagName,
+ uint32_t dwEndPos);
+
+ void OnTargetData(void* pTag,
+ FX_SAXNODE eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
protected:
void UpdateChecksum(FX_BOOL bCheckSpace);
+
CXFA_ChecksumContext* m_pContext;
CXFA_SAXContext m_SAXContext;
};
@@ -57,7 +61,7 @@ class CXFA_ChecksumContext {
~CXFA_ChecksumContext();
void Release() { delete this; }
- FX_BOOL StartChecksum();
+ void StartChecksum();
FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile,
FX_FILESIZE offset = 0,
size_t size = 0);
@@ -66,7 +70,7 @@ class CXFA_ChecksumContext {
void Update(const CFX_ByteStringC& bsText);
protected:
- IFX_SAXReader* m_pSAXReader;
+ CFX_SAXReader* m_pSAXReader;
uint8_t* m_pByteContext;
CFX_ByteString m_bsChecksum;
};
diff --git a/xfa/fxfa/include/xfa_ffapp.h b/xfa/fxfa/include/xfa_ffapp.h
index cad4e88e58..8ecc89df13 100644
--- a/xfa/fxfa/include/xfa_ffapp.h
+++ b/xfa/fxfa/include/xfa_ffapp.h
@@ -67,7 +67,7 @@ class CXFA_FFApp : public IFWL_AdapterNative {
IXFA_AppProvider* m_pProvider;
CXFA_FontMgr* m_pFontMgr;
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- IFX_FontSourceEnum* m_pFontSource;
+ CFX_FontSourceEnum_File* m_pFontSource;
#endif
CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr;
IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate;
diff --git a/xfa/fxfa/include/xfa_fontmgr.h b/xfa/fxfa/include/xfa_fontmgr.h
index cab3cfb219..8b3e20f5e3 100644
--- a/xfa/fxfa/include/xfa_fontmgr.h
+++ b/xfa/fxfa/include/xfa_fontmgr.h
@@ -42,10 +42,11 @@ class CXFA_DefFontMgr {
CFX_PtrArray m_CacheFonts;
};
-class CXFA_PDFFontMgr : public IFX_FontProvider {
+class CXFA_PDFFontMgr {
public:
CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
~CXFA_PDFFontMgr();
+
IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily,
uint32_t dwFontStyles,
CPDF_Font** pPDFFont,