diff options
-rw-r--r-- | core/include/fpdfapi/fpdf_page.h | 9 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 24 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfeditpage.cpp | 2 |
3 files changed, 17 insertions, 18 deletions
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h index d58537aa7e..edcef3c0b6 100644 --- a/core/include/fpdfapi/fpdf_page.h +++ b/core/include/fpdfapi/fpdf_page.h @@ -166,15 +166,15 @@ class CPDF_Form : public CPDF_PageObjects { CPDF_Form* Clone() const; }; -class CPDF_PageContentGenerate { +class CPDF_PageContentGenerator { public: - CPDF_PageContentGenerate(CPDF_Page* pPage); - ~CPDF_PageContentGenerate(); + CPDF_PageContentGenerator(CPDF_Page* pPage); + ~CPDF_PageContentGenerator(); FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject); void GenerateContent(); void TransformContent(CFX_Matrix& matrix); - protected: + private: void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); void ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* data, @@ -183,7 +183,6 @@ class CPDF_PageContentGenerate { CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, const FX_CHAR* szType); - private: CPDF_Page* m_pPage; CPDF_Document* m_pDocument; CFX_ArrayTemplate<CPDF_PageObject*> m_pageObjects; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index f00cf5f8f5..f1565cd9a2 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -14,7 +14,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, CFX_Matrix& matrix) { << matrix.e << " " << matrix.f; return ar; } -CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) +CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage) : m_pPage(pPage) { m_pDocument = NULL; if (m_pPage) { @@ -25,15 +25,15 @@ CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) InsertPageObject(pPage->GetNextObject(pos)); } } -CPDF_PageContentGenerate::~CPDF_PageContentGenerate() {} -FX_BOOL CPDF_PageContentGenerate::InsertPageObject( +CPDF_PageContentGenerator::~CPDF_PageContentGenerator() {} +FX_BOOL CPDF_PageContentGenerator::InsertPageObject( CPDF_PageObject* pPageObject) { if (!pPageObject) { return FALSE; } return m_pageObjects.Add(pPageObject); } -void CPDF_PageContentGenerate::GenerateContent() { +void CPDF_PageContentGenerator::GenerateContent() { CFX_ByteTextBuf buf; CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; for (int i = 0; i < m_pageObjects.GetSize(); ++i) { @@ -53,7 +53,7 @@ void CPDF_PageContentGenerate::GenerateContent() { m_pDocument->AddIndirectObject(pStream); pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); } -CFX_ByteString CPDF_PageContentGenerate::RealizeResource( +CFX_ByteString CPDF_PageContentGenerator::RealizeResource( CPDF_Object* pResourceObj, const FX_CHAR* szType) { if (!m_pPage->m_pResources) { @@ -79,8 +79,8 @@ CFX_ByteString CPDF_PageContentGenerate::RealizeResource( pResList->AddReference(name, m_pDocument, pResourceObj->GetObjNum()); return name; } -void CPDF_PageContentGenerate::ProcessImage(CFX_ByteTextBuf& buf, - CPDF_ImageObject* pImageObj) { +void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, + CPDF_ImageObject* pImageObj) { if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) || (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) { return; @@ -98,10 +98,10 @@ void CPDF_PageContentGenerate::ProcessImage(CFX_ByteTextBuf& buf, buf << "/" << PDF_NameEncode(name) << " Do Q\n"; } } -void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, - const uint8_t* data, - FX_DWORD size, - CFX_Matrix& matrix) { +void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, + const uint8_t* data, + FX_DWORD size, + CFX_Matrix& matrix) { if (!data || !size) { return; } @@ -117,7 +117,7 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, CFX_ByteString name = RealizeResource(pStream, "XObject"); buf << "/" << PDF_NameEncode(name) << " Do Q\n"; } -void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) { +void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { CPDF_Dictionary* pDict = m_pPage->m_pFormDict; CPDF_Object* pContent = pDict ? pDict->GetElementValue("Contents") : NULL; if (!pContent) diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index 9f707b901f..240724fe48 100644 --- a/fpdfsdk/src/fpdfeditpage.cpp +++ b/fpdfsdk/src/fpdfeditpage.cpp @@ -230,7 +230,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) { "Page")) { return FALSE; } - CPDF_PageContentGenerate CG(pPage); + CPDF_PageContentGenerator CG(pPage); CG.GenerateContent(); return TRUE; |