2016-12-02 07:02:56 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef PDFIUMENGINESHIM_H
|
|
|
|
#define PDFIUMENGINESHIM_H
|
|
|
|
|
|
|
|
#include "prlink.h"
|
2017-07-06 05:25:46 +03:00
|
|
|
#include "fpdfview.h"
|
|
|
|
|
2016-12-02 07:02:56 +03:00
|
|
|
/* include windows.h for the HDC definitions that we need. */
|
|
|
|
#include <windows.h>
|
2017-11-01 16:33:28 +03:00
|
|
|
#include "private/pprio.h"
|
2017-11-01 16:51:20 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2016-12-02 07:02:56 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2017-11-01 16:51:20 +03:00
|
|
|
struct PDFFunctionPointerTable;
|
2017-05-12 07:42:20 +03:00
|
|
|
|
2016-12-02 07:02:56 +03:00
|
|
|
/**
|
|
|
|
* This class exposes an interface to the PDFium library and
|
|
|
|
* takes care of loading and linking to the appropriate PDFium symbols.
|
|
|
|
*/
|
|
|
|
class PDFiumEngineShim
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2017-07-06 05:25:46 +03:00
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDFiumEngineShim)
|
|
|
|
|
|
|
|
static already_AddRefed<PDFiumEngineShim> GetInstanceOrNull();
|
2017-09-21 10:22:18 +03:00
|
|
|
// This function is used for testing purpose only, do not call it in regular
|
|
|
|
// code.
|
|
|
|
static already_AddRefed<PDFiumEngineShim>
|
2018-02-24 11:22:27 +03:00
|
|
|
GetInstanceOrNull(const nsString& aLibrary);
|
2017-07-06 05:25:46 +03:00
|
|
|
|
2017-05-12 07:42:20 +03:00
|
|
|
FPDF_DOCUMENT LoadDocument(FPDF_STRING file_path,
|
|
|
|
FPDF_BYTESTRING aPassword);
|
2017-11-01 16:33:28 +03:00
|
|
|
FPDF_DOCUMENT LoadDocument(PRFileDesc* aPrfile,
|
|
|
|
FPDF_BYTESTRING aPassword);
|
2016-12-02 07:02:56 +03:00
|
|
|
void CloseDocument(FPDF_DOCUMENT aDocument);
|
|
|
|
int GetPageCount(FPDF_DOCUMENT aDocument);
|
|
|
|
int GetPageSizeByIndex(FPDF_DOCUMENT aDocument, int aPageIndex,
|
|
|
|
double* aWidth, double* aHeight);
|
|
|
|
|
|
|
|
FPDF_PAGE LoadPage(FPDF_DOCUMENT aDocument, int aPageIndex);
|
|
|
|
void ClosePage(FPDF_PAGE aPage);
|
|
|
|
void RenderPage(HDC aDC, FPDF_PAGE aPage,
|
|
|
|
int aStartX, int aStartY,
|
|
|
|
int aSizeX, int aSizeY,
|
|
|
|
int aRotate, int aFlags);
|
|
|
|
|
|
|
|
private:
|
2017-07-06 05:25:46 +03:00
|
|
|
PDFiumEngineShim();
|
|
|
|
~PDFiumEngineShim();
|
2018-02-24 11:22:27 +03:00
|
|
|
bool Init(const nsString& aLibrary);
|
2016-12-02 07:02:56 +03:00
|
|
|
|
2017-11-01 16:51:20 +03:00
|
|
|
UniquePtr<PDFFunctionPointerTable> mTable;
|
2016-12-02 07:02:56 +03:00
|
|
|
bool mInitialized ;
|
|
|
|
|
2017-07-06 05:25:46 +03:00
|
|
|
PRLibrary* mPRLibrary;
|
2016-12-02 07:02:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* PDFIUMENGINESHIM_H */
|