From 7aba472e80b073fb699c702a0971f31282737bb3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 28 Mar 2018 17:04:16 +0000 Subject: Cleanup fsdk_define methods This CL collects the various fsdk_define methods into a fsdk_define.cpp class. Methods only used in one place are moved into the appropriate anonymous namespaces. Change-Id: I75bfc7e8fe20711106fcf9821adeb41d69bf5848 Reviewed-on: https://pdfium-review.googlesource.com/29310 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/fsdk_define.h | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) (limited to 'fpdfsdk/fsdk_define.h') diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h index 94497bb237..c864f05046 100644 --- a/fpdfsdk/fsdk_define.h +++ b/fpdfsdk/fsdk_define.h @@ -23,7 +23,6 @@ #endif class CPDF_Annot; -class CPDF_ContentMarkItem; class CPDF_Page; class CPDF_PageObject; class CPDF_PageRenderContext; @@ -32,18 +31,6 @@ class CPDF_Stream; class IFSDK_PAUSE_Adapter; class FX_PATHPOINT; -// Layering prevents fxcrt from knowing about FPDF_FILEACCESS, so this can't -// be a static method of IFX_SeekableReadStream. -RetainPtr MakeSeekableReadStream( - FPDF_FILEACCESS* pFileAccess); - -#ifdef PDF_ENABLE_XFA -// Layering prevents fxcrt from knowing about FPDF_FILEHANDLER, so this can't -// be a static method of IFX_SeekableStream. -RetainPtr MakeSeekableStream( - FPDF_FILEHANDLER* pFileHandler); -#endif // PDF_ENABLE_XFA - // Object types for public FPDF_ types; these correspond to next layer down // from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are // CPDFXFA_ types. @@ -57,7 +44,6 @@ using UnderlyingPageType = CPDFXFA_Page; // Conversions to/from underlying types. UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); -FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc); UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page); @@ -66,27 +52,16 @@ CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page); - -CPDF_PathObject* CPDFPathObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object); - CPDF_PageObject* CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object); - -const CPDF_ContentMarkItem* CPDFContentMarkItemFromFPDFPageObjectMark( - FPDF_PAGEOBJECTMARK mark); - -CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment); - ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string); - CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap); -CPDF_Array* CPDFArrayFromDest(FPDF_DEST dest); - -CPDF_Dictionary* CPDFDictionaryFromFPDFAction(FPDF_ACTION action); - -CPDF_Dictionary* CPDFDictionaryFromFPDFBookmark(FPDF_BOOKMARK bookmark); - -CPDF_Dictionary* CPDFDictionaryFromFPDFLink(FPDF_LINK link); +#ifdef PDF_ENABLE_XFA +// Layering prevents fxcrt from knowing about FPDF_FILEHANDLER, so this can't +// be a static method of IFX_SeekableStream. +RetainPtr MakeSeekableStream( + FPDF_FILEHANDLER* pFileHandler); +#endif // PDF_ENABLE_XFA const CPDF_Array* GetQuadPointsArrayFromDictionary(CPDF_Dictionary* dict); bool GetQuadPointsFromDictionary(CPDF_Dictionary* dict, @@ -96,18 +71,17 @@ bool GetQuadPointsFromDictionary(CPDF_Dictionary* dict, CFX_FloatRect CFXFloatRectFromFSRECTF(const FS_RECTF& rect); void FSRECTFFromCFXFloatRect(const CFX_FloatRect& rect, FS_RECTF* out_rect); -const FX_PATHPOINT* FXPathPointFromFPDFPathSegment(FPDF_PATHSEGMENT segment); - unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text, void* buffer, unsigned long buflen); - unsigned long DecodeStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream, void* buffer, unsigned long buflen); void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy); + +// TODO(dsinclair): Where should this live? void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, FPDF_PAGE page, int start_x, @@ -121,7 +95,15 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code); void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot); + +#ifndef _WIN32 +void SetLastError(int err); +int GetLastError(); +#endif // _WIN32 + void ProcessParseError(CPDF_Parser::Error err); + +// TODO(dsinclair): This seems like it should be a public API? FPDF_BOOL FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, unsigned int R, unsigned int G, -- cgit v1.2.3