From 4d29e78fc80285d222f2bad916354e3db970d0cc Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 4 Oct 2016 14:02:47 -0700 Subject: Rename fpdfsdk/fpdfxfa files to match contents Each of these files contains a single class, rename the file to match the internal class name. Review-Url: https://codereview.chromium.org/2385423004 --- fpdfsdk/fpdfxfa/cpdfxfa_document.h | 95 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 fpdfsdk/fpdfxfa/cpdfxfa_document.h (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_document.h') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.h b/fpdfsdk/fpdfxfa/cpdfxfa_document.h new file mode 100644 index 0000000000..f67a880a36 --- /dev/null +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.h @@ -0,0 +1,95 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ +#define FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ + +#include + +#include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" +#include "xfa/fxfa/xfa_ffdoc.h" + +class CPDFSDK_Document; +class CPDFSDK_Environment; +class CPDFXFA_App; +class CPDFXFA_Page; +class CXFA_FFDocHandler; +class IJS_Runtime; +class IJS_Context; + +enum LoadStatus { + FXFA_LOADSTATUS_PRELOAD = 0, + FXFA_LOADSTATUS_LOADING, + FXFA_LOADSTATUS_LOADED, + FXFA_LOADSTATUS_CLOSING, + FXFA_LOADSTATUS_CLOSED +}; + +class CPDFXFA_Document { + public: + CPDFXFA_Document(std::unique_ptr pPDFDoc, + CPDFXFA_App* pProvider); + ~CPDFXFA_Document(); + + FX_BOOL LoadXFADoc(); + CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } + CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } + CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } + int GetDocType() const { return m_iDocType; } + + CPDFSDK_Document* GetSDKDoc() const { return m_pSDKDoc.get(); } + void SetSDKDoc(std::unique_ptr pSDKDoc); + + void DeletePage(int page_index); + int GetPageCount() const; + + CPDFXFA_Page* GetXFAPage(int page_index); + CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const; + + void RemovePage(CPDFXFA_Page* page); + + void ClearChangeMark(); + + protected: + friend class CPDFXFA_DocEnvironment; + + int GetOriginalPageCount() const { return m_nPageCount; } + void SetOriginalPageCount(int count) { + m_nPageCount = count; + m_XFAPageList.SetSize(count); + } + + LoadStatus GetLoadStatus() const { return m_nLoadStatus; } + + CFX_ArrayTemplate* GetXFAPageList() { return &m_XFAPageList; } + + private: + void CloseXFADoc(CXFA_FFDocHandler* pDoc) { + if (pDoc) { + m_pXFADoc->CloseDoc(); + m_pXFADoc.reset(); + m_pXFADocView = nullptr; + } + } + + int m_iDocType; + + std::unique_ptr m_pPDFDoc; + // |m_pSDKDoc| must be destroyed before |m_pPDFDoc| since it needs to access + // it to kill focused annotations. + std::unique_ptr m_pSDKDoc; + std::unique_ptr m_pXFADoc; + CXFA_FFDocView* m_pXFADocView; // not owned. + CPDFXFA_App* const m_pApp; + CFX_ArrayTemplate m_XFAPageList; + LoadStatus m_nLoadStatus; + int m_nPageCount; + + // Must be destroy before |m_pSDKDoc|. + CPDFXFA_DocEnvironment m_DocEnv; +}; + +#endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ -- cgit v1.2.3