Commit 1e35ce87 authored by Oleg Korshul's avatar Oleg Korshul Committed by Alexander Trofimov

сделал общий интерфейс для открытия PdfReader, Djvu, Xps

parent 7fa8727e
#include "DjVu.h" #include "DjVu.h"
#include "DjVuFileImplementation.h" #include "DjVuFileImplementation.h"
#include "../DesktopEditor/fontengine/ApplicationFonts.h"
class CApplicationFonts; CDjVuFile::CDjVuFile(CApplicationFonts* pFonts)
CDjVuFile::CDjVuFile()
{ {
m_pImplementation = new CDjVuFileImplementation(); m_pImplementation = new CDjVuFileImplementation(pFonts);
} }
CDjVuFile::~CDjVuFile() CDjVuFile::~CDjVuFile()
{ {
if (m_pImplementation) if (m_pImplementation)
delete m_pImplementation; delete m_pImplementation;
} }
bool CDjVuFile::LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXMLOptions) bool CDjVuFile::LoadFromFile(const std::wstring& file, const std::wstring& options,
const std::wstring& owner_password, const std::wstring& user_password)
{ {
if (m_pImplementation) if (m_pImplementation)
return m_pImplementation->LoadFromFile(wsSrcFileName, wsXMLOptions); return m_pImplementation->LoadFromFile(file, options);
return false; return false;
} }
void CDjVuFile::Close() void CDjVuFile::Close()
{ {
if (m_pImplementation) if (m_pImplementation)
m_pImplementation->Close(); m_pImplementation->Close();
} }
std::wstring CDjVuFile::GetTempDirectory() const
{
if (m_pImplementation)
return m_pImplementation->GetTempDirectory();
return L""; std::wstring CDjVuFile::GetTempDirectory()
{
return m_pImplementation ? m_pImplementation->GetTempDirectory() : L"";
} }
void CDjVuFile::SetTempDirectory(const std::wstring& wsDirectory) void CDjVuFile::SetTempDirectory(const std::wstring& wsDirectory)
{ {
if (m_pImplementation) if (m_pImplementation)
m_pImplementation->SetTempDirectory(wsDirectory); m_pImplementation->SetTempDirectory(wsDirectory);
} }
int CDjVuFile::GetPagesCount() const
int CDjVuFile::GetPagesCount()
{ {
if (m_pImplementation) if (m_pImplementation)
return m_pImplementation->GetPagesCount(); return m_pImplementation->GetPagesCount();
return 0; return 0;
} }
void CDjVuFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY) const void CDjVuFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY)
{ {
if (m_pImplementation) if (m_pImplementation)
m_pImplementation->GetPageInfo(nPageIndex, pdWidth, pdHeight, pdDpiX, pdDpiY); m_pImplementation->GetPageInfo(nPageIndex, pdWidth, pdHeight, pdDpiX, pdDpiY);
...@@ -52,13 +52,13 @@ void CDjVuFile::DrawPageOnRenderer(IRenderer* pRenderer, int nPage ...@@ -52,13 +52,13 @@ void CDjVuFile::DrawPageOnRenderer(IRenderer* pRenderer, int nPage
if (m_pImplementation) if (m_pImplementation)
m_pImplementation->DrawPageOnRenderer(pRenderer, nPageIndex, pBreak); m_pImplementation->DrawPageOnRenderer(pRenderer, nPageIndex, pBreak);
} }
void CDjVuFile::ConvertToRaster(CApplicationFonts* pAppFonts, int nPageIndex, const std::wstring& wsDstPath, int nImageType) void CDjVuFile::ConvertToRaster(int nPageIndex, const std::wstring& wsDstPath, int nImageType)
{ {
if (m_pImplementation) if (m_pImplementation)
m_pImplementation->ConvertToRaster(pAppFonts, nPageIndex, wsDstPath, nImageType); m_pImplementation->ConvertToRaster(nPageIndex, wsDstPath, nImageType);
} }
void CDjVuFile::ConvertToPdf(CApplicationFonts* pAppFonts, const std::wstring& wsDstPath) void CDjVuFile::ConvertToPdf(const std::wstring& wsDstPath)
{ {
if (m_pImplementation) if (m_pImplementation)
m_pImplementation->ConvertToPdf(pAppFonts, wsDstPath); m_pImplementation->ConvertToPdf(wsDstPath);
} }
#pragma once #pragma once
#include <string>
#include "../DesktopEditor/graphics/IRenderer.h"
#ifndef DJVU_USE_DYNAMIC_LIBRARY #ifndef DJVU_USE_DYNAMIC_LIBRARY
#define DJVU_DECL_EXPORT #define DJVU_DECL_EXPORT
#else #else
...@@ -10,28 +7,33 @@ ...@@ -10,28 +7,33 @@
#define DJVU_DECL_EXPORT Q_DECL_EXPORT #define DJVU_DECL_EXPORT Q_DECL_EXPORT
#endif #endif
// –аботаем через класс CDjVuFileImplementation, чтобы когда цепл¤лс¤ данный h-файл, ничего лишнего не инклюдилось #include "../DesktopEditor/common/officedrawingfile.h"
// работаем через класс CDjVuFileImplementation, чтобы когда цеплялся данный h-файл, ничего лишнего не инклюдилось
class CDjVuFileImplementation; class CDjVuFileImplementation;
class CApplicationFonts;
class DJVU_DECL_EXPORT CDjVuFile class DJVU_DECL_EXPORT CDjVuFile : public IOfficeDrawingFile
{ {
private: private:
CDjVuFileImplementation* m_pImplementation; CDjVuFileImplementation* m_pImplementation;
public: public:
CDjVuFile(); CDjVuFile(CApplicationFonts* fonts);
~CDjVuFile(); virtual ~CDjVuFile();
bool LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXmlOptions = L""); virtual bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
void Close(); const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
std::wstring GetTempDirectory() const;
void SetTempDirectory(const std::wstring& wsDirectory); virtual void Close();
int GetPagesCount() const;
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY) const; virtual std::wstring GetTempDirectory();
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak); virtual void SetTempDirectory(const std::wstring& directory);
void ConvertToRaster(CApplicationFonts* pAppFonts, int nPageIndex, const std::wstring& wsDstPath, int nImageType);
void ConvertToPdf(CApplicationFonts* pAppFonts, const std::wstring& wsDstPath); virtual int GetPagesCount();
virtual void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
virtual void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
virtual void ConvertToRaster(int nPageIndex, const std::wstring& path, int nImageType);
void ConvertToPdf(const std::wstring& path);
}; };
...@@ -58,13 +58,15 @@ namespace NSDjvu ...@@ -58,13 +58,15 @@ namespace NSDjvu
} }
} }
CDjVuFileImplementation::CDjVuFileImplementation() CDjVuFileImplementation::CDjVuFileImplementation(CApplicationFonts* pFonts)
{ {
m_pDoc = NULL; m_pDoc = NULL;
std::wstring wsTempPath = NSFile::CFileBinary::GetTempPath(); std::wstring wsTempPath = NSFile::CFileBinary::GetTempPath();
wsTempPath += L"DJVU\\"; wsTempPath += L"DJVU\\";
m_wsTempDirectory = wsTempPath; m_wsTempDirectory = wsTempPath;
NSDirectory::CreateDirectory(m_wsTempDirectory); NSDirectory::CreateDirectory(m_wsTempDirectory);
m_pApplicationFonts = pFonts;
} }
CDjVuFileImplementation::~CDjVuFileImplementation() CDjVuFileImplementation::~CDjVuFileImplementation()
{ {
...@@ -164,11 +166,14 @@ void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRende ...@@ -164,11 +166,14 @@ void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRende
// белая страница // белая страница
} }
} }
void CDjVuFileImplementation::ConvertToRaster(CApplicationFonts* pAppFonts, int nPageIndex, const std::wstring& wsDstPath, int nImageType) void CDjVuFileImplementation::ConvertToRaster(int nPageIndex, const std::wstring& wsDstPath, int nImageType)
{ {
CFontManager *pFontManager = pAppFonts->GenerateFontManager(); if (!m_pApplicationFonts)
return;
CFontManager *pFontManager = m_pApplicationFonts->GenerateFontManager();
CFontsCache* pFontCache = new CFontsCache(); CFontsCache* pFontCache = new CFontsCache();
pFontCache->SetStreams(pAppFonts->GetStreams()); pFontCache->SetStreams(m_pApplicationFonts->GetStreams());
pFontManager->SetOwnerCache(pFontCache); pFontManager->SetOwnerCache(pFontCache);
CGraphicsRenderer oRenderer; CGraphicsRenderer oRenderer;
...@@ -203,9 +208,9 @@ void CDjVuFileImplementation::ConvertToRaster(CApplicationFonts* p ...@@ -203,9 +208,9 @@ void CDjVuFileImplementation::ConvertToRaster(CApplicationFonts* p
oFrame.SaveFile(wsDstPath, nImageType); oFrame.SaveFile(wsDstPath, nImageType);
RELEASEINTERFACE(pFontManager); RELEASEINTERFACE(pFontManager);
} }
void CDjVuFileImplementation::ConvertToPdf(CApplicationFonts* pAppFonts, const std::wstring& wsDstPath) void CDjVuFileImplementation::ConvertToPdf(const std::wstring& wsDstPath)
{ {
CPdfRenderer oPdf(pAppFonts); CPdfRenderer oPdf(m_pApplicationFonts);
bool bBreak = false; bool bBreak = false;
for (int nPageIndex = 0, nPagesCount = GetPagesCount(); nPageIndex < nPagesCount; nPageIndex++) for (int nPageIndex = 0, nPagesCount = GetPagesCount(); nPageIndex < nPagesCount; nPageIndex++)
......
...@@ -32,10 +32,11 @@ private: ...@@ -32,10 +32,11 @@ private:
std::wstring m_wsTempDirectory; std::wstring m_wsTempDirectory;
GP<DjVuDocument> m_pDoc; GP<DjVuDocument> m_pDoc;
CApplicationFonts* m_pApplicationFonts;
public: public:
CDjVuFileImplementation(); CDjVuFileImplementation(CApplicationFonts* pFonts);
~CDjVuFileImplementation(); ~CDjVuFileImplementation();
bool LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXmlOptions = L""); bool LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXmlOptions = L"");
...@@ -45,8 +46,8 @@ public: ...@@ -45,8 +46,8 @@ public:
int GetPagesCount() const; int GetPagesCount() const;
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY) const; void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY) const;
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak); void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
void ConvertToRaster(CApplicationFonts* pAppFonts, int nPageIndex, const std::wstring& wsDstPath, int nImageType); void ConvertToRaster(int nPageIndex, const std::wstring& wsDstPath, int nImageType);
void ConvertToPdf(CApplicationFonts* pAppFonts, const std::wstring& wsDstPath); void ConvertToPdf(const std::wstring& wsDstPath);
private: private:
......
This diff is collapsed.
#ifndef _PDF_READER_H #ifndef _PDF_READER_H
#define _PDF_READER_H #define _PDF_READER_H
#include "Src/ErrorConstants.h"
class IRenderer;
class CFontManager;
class CApplicationFonts;
#ifndef PDFREADER_USE_DYNAMIC_LIBRARY #ifndef PDFREADER_USE_DYNAMIC_LIBRARY
#define PDFREADER_DECL_EXPORT #define PDFREADER_DECL_EXPORT
#else #else
...@@ -14,48 +8,44 @@ class CApplicationFonts; ...@@ -14,48 +8,44 @@ class CApplicationFonts;
#define PDFREADER_DECL_EXPORT Q_DECL_EXPORT #define PDFREADER_DECL_EXPORT Q_DECL_EXPORT
#endif #endif
#include "Src/ErrorConstants.h"
#include "../DesktopEditor/common/officedrawingfile.h"
namespace PdfReader namespace PdfReader
{ {
class PDFDoc; class CPdfReader_Private;
class GlobalParams;
class CFontList;
class PDFREADER_DECL_EXPORT CPdfReader class PDFREADER_DECL_EXPORT CPdfReader
{ {
public: public:
CPdfReader(CApplicationFonts* pAppFonts); CPdfReader(CApplicationFonts* fonts);
~CPdfReader(); ~CPdfReader();
bool LoadFromFile(const wchar_t* wsSrcPath, const wchar_t* wsOwnerPassword = 0, const wchar_t* wsUserPassword = 0, const wchar_t* wsOptions = 0); virtual bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
void Close(); const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
virtual void Close();
virtual std::wstring GetTempDirectory();
virtual void SetTempDirectory(const std::wstring& directory);
virtual int GetPagesCount();
virtual void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
virtual void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
virtual void ConvertToRaster(int nPageIndex, const std::wstring& path, int nImageType);
EError GetError(); EError GetError();
double GetVersion(); double GetVersion();
int GetPermissions(); int GetPermissions();
int GetPagesCount();
void GetPageSize(int nPageIndex, double* pdWidth, double* pdHeight);
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pbBreak);
void ConvertToRaster(int nPageIndex, const wchar_t* wsDstPath, int nImageType);
bool ExtractAllImages(const wchar_t* wsDstPath, const wchar_t* wsPrefix = 0); bool ExtractAllImages(const wchar_t* wsDstPath, const wchar_t* wsPrefix = 0);
int GetImagesCount(); int GetImagesCount();
void SetTempFolder(const wchar_t* wsTempFolder);
void SetCMapFolder(const wchar_t* wsCMapFolder); void SetCMapFolder(const wchar_t* wsCMapFolder);
CFontManager*GetFontManager(); CFontManager*GetFontManager();
private: private:
CPdfReader_Private* m_pInternal;
PDFDoc* m_pPDFDocument;
GlobalParams* m_pGlobalParams;
wchar_t* m_wsTempFolder;
wchar_t* m_wsCMapFolder;
CApplicationFonts* m_pAppFonts;
CFontManager* m_pFontManager;
CFontList* m_pFontList;
}; };
} }
......
...@@ -12,8 +12,17 @@ ...@@ -12,8 +12,17 @@
using namespace XPS; using namespace XPS;
CXpsFile::CXpsFile(CApplicationFonts* pAppFonts) class CXpsFile_Private
{ {
public:
CApplicationFonts* m_pAppFonts;
CFontManager* m_pFontManager;
std::wstring m_wsTempFolder;
XPS::CDocument* m_pDocument;
public:
CXpsFile_Private(CApplicationFonts* pAppFonts)
{
m_pDocument = NULL; m_pDocument = NULL;
m_pAppFonts = pAppFonts; m_pAppFonts = pAppFonts;
...@@ -26,74 +35,84 @@ CXpsFile::CXpsFile(CApplicationFonts* pAppFonts) ...@@ -26,74 +35,84 @@ CXpsFile::CXpsFile(CApplicationFonts* pAppFonts)
pMeasurerCache->SetCacheSize(16); pMeasurerCache->SetCacheSize(16);
m_wsTempFolder = L""; m_wsTempFolder = L"";
SetTempFolder(NSFile::CFileBinary::GetTempPath()); }
~CXpsFile_Private()
{
}
};
CXpsFile::CXpsFile(CApplicationFonts* pAppFonts)
{
m_pInternal = new CXpsFile_Private(pAppFonts);
SetTempDirectory(NSFile::CFileBinary::GetTempPath());
} }
CXpsFile::~CXpsFile() CXpsFile::~CXpsFile()
{ {
if (L"" != m_wsTempFolder) if (L"" != m_pInternal->m_wsTempFolder)
NSDirectory::DeleteDirectory(m_wsTempFolder); NSDirectory::DeleteDirectory(m_pInternal->m_wsTempFolder);
Close(); Close();
RELEASEINTERFACE(m_pFontManager); RELEASEINTERFACE((m_pInternal->m_pFontManager));
} }
std::wstring CXpsFile::GetTempFolder() const std::wstring CXpsFile::GetTempDirectory()
{ {
return m_wsTempFolder; return m_pInternal->m_wsTempFolder;
} }
void CXpsFile::SetTempFolder(const std::wstring& wsPath) void CXpsFile::SetTempDirectory(const std::wstring& wsPath)
{ {
if (L"" != m_wsTempFolder) if (L"" != m_pInternal->m_wsTempFolder)
NSDirectory::DeleteDirectory(m_wsTempFolder); NSDirectory::DeleteDirectory(m_pInternal->m_wsTempFolder);
int nCounter = 0; int nCounter = 0;
m_wsTempFolder = wsPath + L"/XPS/"; m_pInternal->m_wsTempFolder = wsPath + L"/XPS/";
while (NSDirectory::Exists(m_wsTempFolder)) while (NSDirectory::Exists(m_pInternal->m_wsTempFolder))
{ {
m_wsTempFolder = wsPath + L"/XPS" + std::to_wstring(nCounter) + L"/"; m_pInternal->m_wsTempFolder = wsPath + L"/XPS" + std::to_wstring(nCounter) + L"/";
nCounter++; nCounter++;
} }
NSDirectory::CreateDirectory(m_wsTempFolder); NSDirectory::CreateDirectory(m_pInternal->m_wsTempFolder);
} }
bool CXpsFile::LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXmlOptions) bool CXpsFile::LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXmlOptions,
const std::wstring& owner_password, const std::wstring& user_password)
{ {
Close(); Close();
// Распаковываем Zip-архив в темповую папку // Распаковываем Zip-архив в темповую папку
COfficeUtils oUtils(NULL); COfficeUtils oUtils(NULL);
if (S_OK != oUtils.ExtractToDirectory(wsSrcFileName, m_wsTempFolder, NULL, 0)) if (S_OK != oUtils.ExtractToDirectory(wsSrcFileName, m_pInternal->m_wsTempFolder, NULL, 0))
return false; return false;
m_pDocument = new XPS::CDocument(m_pFontManager); m_pInternal->m_pDocument = new XPS::CDocument(m_pInternal->m_pFontManager);
if (!m_pDocument) if (!m_pInternal->m_pDocument)
return false; return false;
std::wstring wsPath = m_wsTempFolder + L"/"; std::wstring wsPath = m_pInternal->m_wsTempFolder + L"/";
m_pDocument->ReadFromPath(wsPath); m_pInternal->m_pDocument->ReadFromPath(wsPath);
return true; return true;
} }
void CXpsFile::Close() void CXpsFile::Close()
{ {
if (m_pDocument) if (m_pInternal->m_pDocument)
{ {
m_pDocument->Close(); m_pInternal->m_pDocument->Close();
delete m_pDocument; delete m_pInternal->m_pDocument;
m_pDocument = NULL; m_pInternal->m_pDocument = NULL;
} }
} }
int CXpsFile::GetPagesCount() int CXpsFile::GetPagesCount()
{ {
if (!m_pDocument) if (!m_pInternal->m_pDocument)
return 0; return 0;
return m_pDocument->GetPageCount(); return m_pInternal->m_pDocument->GetPageCount();
} }
void CXpsFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY) void CXpsFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY)
{ {
int nW = 0, nH = 0; int nW = 0, nH = 0;
if (m_pDocument) if (m_pInternal->m_pDocument)
m_pDocument->GetPageSize(nPageIndex, nW, nH); m_pInternal->m_pDocument->GetPageSize(nPageIndex, nW, nH);
*pdWidth = nW * 25.4 / 96; *pdWidth = nW * 25.4 / 96;
*pdHeight = nH * 25.4 / 96; *pdHeight = nH * 25.4 / 96;
...@@ -102,16 +121,16 @@ void CXpsFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHe ...@@ -102,16 +121,16 @@ void CXpsFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHe
} }
void CXpsFile::DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak) void CXpsFile::DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak)
{ {
if (!m_pDocument) if (!m_pInternal->m_pDocument)
return; return;
m_pDocument->DrawPage(nPageIndex, pRenderer, pBreak); m_pInternal->m_pDocument->DrawPage(nPageIndex, pRenderer, pBreak);
} }
void CXpsFile::ConvertToRaster(int nPageIndex, const std::wstring& wsDstPath, int nImageType) void CXpsFile::ConvertToRaster(int nPageIndex, const std::wstring& wsDstPath, int nImageType)
{ {
CFontManager *pFontManager = m_pAppFonts->GenerateFontManager(); CFontManager *pFontManager = m_pInternal->m_pAppFonts->GenerateFontManager();
CFontsCache* pFontCache = new CFontsCache(); CFontsCache* pFontCache = new CFontsCache();
pFontCache->SetStreams(m_pAppFonts->GetStreams()); pFontCache->SetStreams(m_pInternal->m_pAppFonts->GetStreams());
pFontManager->SetOwnerCache(pFontCache); pFontManager->SetOwnerCache(pFontCache);
CGraphicsRenderer oRenderer; CGraphicsRenderer oRenderer;
...@@ -148,7 +167,7 @@ void CXpsFile::ConvertToRaster(int nPageIndex, const std::wstring& wsDst ...@@ -148,7 +167,7 @@ void CXpsFile::ConvertToRaster(int nPageIndex, const std::wstring& wsDst
} }
void CXpsFile::ConvertToPdf(const std::wstring& wsPath) void CXpsFile::ConvertToPdf(const std::wstring& wsPath)
{ {
CPdfRenderer oPdf(m_pAppFonts); CPdfRenderer oPdf(m_pInternal->m_pAppFonts);
bool bBreak = false; bool bBreak = false;
int nPagesCount = GetPagesCount(); int nPagesCount = GetPagesCount();
......
#ifndef _XPS_FILE_H #ifndef _XPS_FILE_H
#define _XPS_FILE_H #define _XPS_FILE_H
#include <string>
#ifndef XPS_USE_DYNAMIC_LIBRARY #ifndef XPS_USE_DYNAMIC_LIBRARY
#define XPS_DECL_EXPORT #define XPS_DECL_EXPORT
#else #else
...@@ -10,37 +8,32 @@ ...@@ -10,37 +8,32 @@
#define XPS_DECL_EXPORT Q_DECL_EXPORT #define XPS_DECL_EXPORT Q_DECL_EXPORT
#endif #endif
namespace XPS #include "../DesktopEditor/common/officedrawingfile.h"
{
class CDocument;
}
class IRenderer;
class CApplicationFonts;
class CFontManager;
class CXpsFile_Private;
class XPS_DECL_EXPORT CXpsFile class XPS_DECL_EXPORT CXpsFile
{ {
public: public:
CXpsFile(CApplicationFonts* pAppFonts); CXpsFile(CApplicationFonts* fonts);
~CXpsFile(); virtual ~CXpsFile();
bool LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXmlOptions = L""); virtual bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
void Close(); const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
std::wstring GetTempFolder() const;
void SetTempFolder(const std::wstring& wsPath); virtual void Close();
int GetPagesCount();
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY); virtual std::wstring GetTempDirectory();
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak); virtual void SetTempDirectory(const std::wstring& directory);
void ConvertToRaster(int nPageIndex, const std::wstring& wsDstPath, int nImageType);
virtual int GetPagesCount();
virtual void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
virtual void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
virtual void ConvertToRaster(int nPageIndex, const std::wstring& path, int nImageType);
void ConvertToPdf(const std::wstring& wsDstPath); void ConvertToPdf(const std::wstring& wsDstPath);
private: private:
CXpsFile_Private* m_pInternal;
CApplicationFonts* m_pAppFonts;
CFontManager* m_pFontManager;
std::wstring m_wsTempFolder;
XPS::CDocument* m_pDocument;
}; };
#endif // _XPS_FILE_H #endif // _XPS_FILE_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment