mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix PdfReader and PdfWriter, fix BUILDING_WASM_MODULE
This commit is contained in:
@ -156,7 +156,7 @@
|
||||
{
|
||||
"name": "p",
|
||||
"folder": "../../../../PdfReader/",
|
||||
"files": ["PdfReader.cpp", "Src/Adaptors.cpp", "Src/GfxClip.cpp", "Src/RendererOutputDev.cpp", "Src/JPXStream2.cpp", "Resources/BaseFonts.cpp", "Resources/CMapMemory/cmap_memory.cpp", "lib/fofi/FofiBase.cc", "lib/fofi/FofiEncodings.cc", "lib/fofi/FofiIdentifier.cc", "lib/fofi/FofiTrueType.cc", "lib/fofi/FofiType1.cc", "lib/fofi/FofiType1C.cc", "lib/goo/FixedPoint.cc", "lib/goo/gfile.cc", "lib/goo/GHash.cc", "lib/goo/GList.cc", "lib/goo/gmem.cc", "lib/goo/gmempp.cc", "lib/goo/GString.cc", "lib/goo/parseargs.c", "lib/goo/Trace.cc", "lib/splash/Splash.cc", "lib/splash/SplashBitmap.cc", "lib/splash/SplashClip.cc", "lib/splash/SplashFont.cc", "lib/splash/SplashFontEngine.cc", "lib/splash/SplashFontFile.cc", "lib/splash/SplashFontFileID.cc", "lib/splash/SplashFTFont.cc", "lib/splash/SplashFTFontEngine.cc", "lib/splash/SplashFTFontFile.cc", "lib/splash/SplashPath.cc", "lib/splash/SplashPattern.cc", "lib/splash/SplashScreen.cc", "lib/splash/SplashState.cc", "lib/splash/SplashXPath.cc", "lib/splash/SplashXPathScanner.cc", "lib/xpdf/AcroForm.cc", "lib/xpdf/Annot.cc", "lib/xpdf/Array.cc", "lib/xpdf/BuiltinFont.cc", "lib/xpdf/BuiltinFontTables.cc", "lib/xpdf/Catalog.cc", "lib/xpdf/CharCodeToUnicode.cc", "lib/xpdf/CMap.cc", "lib/xpdf/Decrypt.cc", "lib/xpdf/Dict.cc", "lib/xpdf/DisplayState.cc", "lib/xpdf/Error.cc", "lib/xpdf/FontEncodingTables.cc", "lib/xpdf/Function.cc", "lib/xpdf/Gfx.cc", "lib/xpdf/GfxFont.cc", "lib/xpdf/GfxState.cc", "lib/xpdf/GlobalParams.cc", "lib/xpdf/ImageOutputDev.cc", "lib/xpdf/JArithmeticDecoder.cc", "lib/xpdf/JBIG2Stream.cc", "lib/xpdf/JPXStream.cc", "lib/xpdf/Lexer.cc", "lib/xpdf/Link.cc", "lib/xpdf/NameToCharCode.cc", "lib/xpdf/Object.cc", "lib/xpdf/OptionalContent.cc", "lib/xpdf/Outline.cc", "lib/xpdf/OutputDev.cc", "lib/xpdf/Page.cc", "lib/xpdf/Parser.cc", "lib/xpdf/PDF417Barcode.cc", "lib/xpdf/PDFCore.cc", "lib/xpdf/PDFDoc.cc", "lib/xpdf/PDFDocEncoding.cc", "lib/xpdf/PreScanOutputDev.cc", "lib/xpdf/PSOutputDev.cc", "lib/xpdf/PSTokenizer.cc", "lib/xpdf/SecurityHandler.cc", "lib/xpdf/ShadingImage.cc", "lib/xpdf/SplashOutputDev.cc", "lib/xpdf/Stream.cc", "lib/xpdf/TextOutputDev.cc", "lib/xpdf/TextString.cc", "lib/xpdf/TileCache.cc", "lib/xpdf/TileCompositor.cc", "lib/xpdf/TileMap.cc", "lib/xpdf/UnicodeMap.cc", "lib/xpdf/UnicodeRemapping.cc", "lib/xpdf/UnicodeTypeTable.cc", "lib/xpdf/UTF8.cc", "lib/xpdf/WebFont.cc", "lib/xpdf/XFAScanner.cc", "lib/xpdf/XRef.cc", "lib/xpdf/Zoox.cc"]
|
||||
"files": ["Src/Adaptors.cpp", "Src/GfxClip.cpp", "Src/RendererOutputDev.cpp", "Src/JPXStream2.cpp", "Resources/BaseFonts.cpp", "Resources/CMapMemory/cmap_memory.cpp", "lib/fofi/FofiBase.cc", "lib/fofi/FofiEncodings.cc", "lib/fofi/FofiIdentifier.cc", "lib/fofi/FofiTrueType.cc", "lib/fofi/FofiType1.cc", "lib/fofi/FofiType1C.cc", "lib/goo/FixedPoint.cc", "lib/goo/gfile.cc", "lib/goo/GHash.cc", "lib/goo/GList.cc", "lib/goo/gmem.cc", "lib/goo/gmempp.cc", "lib/goo/GString.cc", "lib/goo/parseargs.c", "lib/goo/Trace.cc", "lib/splash/Splash.cc", "lib/splash/SplashBitmap.cc", "lib/splash/SplashClip.cc", "lib/splash/SplashFont.cc", "lib/splash/SplashFontEngine.cc", "lib/splash/SplashFontFile.cc", "lib/splash/SplashFontFileID.cc", "lib/splash/SplashFTFont.cc", "lib/splash/SplashFTFontEngine.cc", "lib/splash/SplashFTFontFile.cc", "lib/splash/SplashPath.cc", "lib/splash/SplashPattern.cc", "lib/splash/SplashScreen.cc", "lib/splash/SplashState.cc", "lib/splash/SplashXPath.cc", "lib/splash/SplashXPathScanner.cc", "lib/xpdf/AcroForm.cc", "lib/xpdf/Annot.cc", "lib/xpdf/Array.cc", "lib/xpdf/BuiltinFont.cc", "lib/xpdf/BuiltinFontTables.cc", "lib/xpdf/Catalog.cc", "lib/xpdf/CharCodeToUnicode.cc", "lib/xpdf/CMap.cc", "lib/xpdf/Decrypt.cc", "lib/xpdf/Dict.cc", "lib/xpdf/DisplayState.cc", "lib/xpdf/Error.cc", "lib/xpdf/FontEncodingTables.cc", "lib/xpdf/Function.cc", "lib/xpdf/Gfx.cc", "lib/xpdf/GfxFont.cc", "lib/xpdf/GfxState.cc", "lib/xpdf/GlobalParams.cc", "lib/xpdf/ImageOutputDev.cc", "lib/xpdf/JArithmeticDecoder.cc", "lib/xpdf/JBIG2Stream.cc", "lib/xpdf/JPXStream.cc", "lib/xpdf/Lexer.cc", "lib/xpdf/Link.cc", "lib/xpdf/NameToCharCode.cc", "lib/xpdf/Object.cc", "lib/xpdf/OptionalContent.cc", "lib/xpdf/Outline.cc", "lib/xpdf/OutputDev.cc", "lib/xpdf/Page.cc", "lib/xpdf/Parser.cc", "lib/xpdf/PDF417Barcode.cc", "lib/xpdf/PDFCore.cc", "lib/xpdf/PDFDoc.cc", "lib/xpdf/PDFDocEncoding.cc", "lib/xpdf/PreScanOutputDev.cc", "lib/xpdf/PSOutputDev.cc", "lib/xpdf/PSTokenizer.cc", "lib/xpdf/SecurityHandler.cc", "lib/xpdf/ShadingImage.cc", "lib/xpdf/SplashOutputDev.cc", "lib/xpdf/Stream.cc", "lib/xpdf/TextOutputDev.cc", "lib/xpdf/TextString.cc", "lib/xpdf/TileCache.cc", "lib/xpdf/TileCompositor.cc", "lib/xpdf/TileMap.cc", "lib/xpdf/UnicodeMap.cc", "lib/xpdf/UnicodeRemapping.cc", "lib/xpdf/UnicodeTypeTable.cc", "lib/xpdf/UTF8.cc", "lib/xpdf/WebFont.cc", "lib/xpdf/XFAScanner.cc", "lib/xpdf/XRef.cc", "lib/xpdf/Zoox.cc"]
|
||||
},
|
||||
{
|
||||
"name": "opj",
|
||||
@ -192,6 +192,11 @@
|
||||
"name": "u",
|
||||
"folder": "../../../../UnicodeConverter/",
|
||||
"files": ["UnicodeConverter.cpp"]
|
||||
},
|
||||
{
|
||||
"name": "pd",
|
||||
"folder": "../../../../PdfFile/",
|
||||
"files": ["PdfFile.cpp", "Src/PdfReader.cpp"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -86,10 +86,8 @@ public:
|
||||
|
||||
// Common methods for viewer
|
||||
virtual std::wstring GetInfo() = 0;
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
virtual unsigned char* GetStructure() = 0;
|
||||
virtual unsigned char* GetLinks(int nPageIndex) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _OFFICE_DRAWING_FILE_H
|
||||
|
||||
@ -109,7 +109,6 @@ void CDjVuFile::ConvertToPdf(const std::wstring& wsDstPath)
|
||||
if (m_pImplementation)
|
||||
m_pImplementation->ConvertToPdf(wsDstPath);
|
||||
}
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
BYTE* CDjVuFile::GetStructure()
|
||||
{
|
||||
if (m_pImplementation)
|
||||
@ -122,4 +121,3 @@ BYTE* CDjVuFile::GetLinks (int nPageIndex)
|
||||
return m_pImplementation->GetPageLinks(nPageIndex);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -74,8 +74,6 @@ public:
|
||||
|
||||
void ConvertToPdf(const std::wstring& path);
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
virtual BYTE* GetStructure();
|
||||
virtual BYTE* GetLinks (int nPageIndex);
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -47,9 +47,10 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
#define DISABLE_TEMP_DIRECTORY
|
||||
#include "../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
#endif
|
||||
|
||||
namespace NSDjvu
|
||||
@ -277,7 +278,6 @@ std::wstring CDjVuFileImplementation::GetInfo()
|
||||
return sRes;
|
||||
}
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
void getBookmars(const GP<DjVmNav>& nav, int& pos, int count, NSWasm::CData& out, int level)
|
||||
{
|
||||
while (count > 0 && pos < nav->getBookMarkCount())
|
||||
@ -422,7 +422,6 @@ BYTE* CDjVuFileImplementation::GetPageLinks(int nPageIndex)
|
||||
catch (...) {}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& pPage, int nPage, XmlUtils::CXmlNode& text)
|
||||
{
|
||||
|
||||
@ -51,10 +51,6 @@
|
||||
#include "../DesktopEditor/graphics/IRenderer.h"
|
||||
#include "../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
#include "../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
#endif
|
||||
|
||||
class CDjVuFileImplementation
|
||||
{
|
||||
private:
|
||||
@ -79,11 +75,9 @@ public:
|
||||
void ConvertToPdf(const std::wstring& wsDstPath);
|
||||
std::wstring GetInfo();
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
BYTE* GetStructure();
|
||||
BYTE* GetPageGlyphs(int nPageIndex);
|
||||
BYTE* GetPageLinks (int nPageIndex);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -160,11 +160,12 @@ class CPdfFile_Private
|
||||
{
|
||||
public:
|
||||
CPdfWriter* pWriter;
|
||||
PdfReader::CPdfReader* pReader;
|
||||
CPdfReader* pReader;
|
||||
std::wstring wsSrcFile;
|
||||
std::wstring wsPassword;
|
||||
bool bEdit;
|
||||
bool bEditPage;
|
||||
NSFonts::IApplicationFonts* pAppFonts;
|
||||
|
||||
void GetPageTree(XRef* xref, Object* pPagesRefObj)
|
||||
{
|
||||
@ -239,8 +240,9 @@ CPdfFile::CPdfFile(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA)
|
||||
{
|
||||
m_pInternal = new CPdfFile_Private();
|
||||
|
||||
m_pInternal->pWriter = new CPdfWriter(pAppFonts, isPDFA);
|
||||
m_pInternal->pReader = new PdfReader::CPdfReader(pAppFonts);
|
||||
m_pInternal->pAppFonts = pAppFonts;
|
||||
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, isPDFA);
|
||||
m_pInternal->pReader = new CPdfReader(m_pInternal->pAppFonts);
|
||||
m_pInternal->wsPassword = L"";
|
||||
m_pInternal->bEdit = false;
|
||||
m_pInternal->bEditPage = false;
|
||||
@ -250,10 +252,11 @@ CPdfFile::CPdfFile(NSFonts::IApplicationFonts* pAppFonts, int nMode, bool isPDFA
|
||||
{
|
||||
m_pInternal = new CPdfFile_Private();
|
||||
|
||||
m_pInternal->pAppFonts = pAppFonts;
|
||||
if (nMode & 1)
|
||||
m_pInternal->pReader = new PdfReader::CPdfReader(pAppFonts);
|
||||
m_pInternal->pReader = new CPdfReader(m_pInternal->pAppFonts);
|
||||
if (nMode & 2)
|
||||
m_pInternal->pWriter = new CPdfWriter(pAppFonts, isPDFA);
|
||||
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, isPDFA);
|
||||
m_pInternal->wsPassword = L"";
|
||||
m_pInternal->bEdit = false;
|
||||
m_pInternal->bEditPage = false;
|
||||
@ -653,13 +656,13 @@ bool CPdfFile::LoadFromFile(const std::wstring& file, const std::wstring& option
|
||||
{
|
||||
m_pInternal->wsSrcFile = file;
|
||||
m_pInternal->wsPassword = owner_password;
|
||||
return m_pInternal->pReader->LoadFromFile(file, L"", owner_password, user_password) && (m_pInternal->pReader->GetError() == 0);
|
||||
return m_pInternal->pReader->LoadFromFile(m_pInternal->pAppFonts, file, owner_password, user_password) && (m_pInternal->pReader->GetError() == 0);
|
||||
}
|
||||
bool CPdfFile::LoadFromMemory(BYTE* data, DWORD length, const std::wstring& options, const std::wstring& owner_password, const std::wstring& user_password)
|
||||
{
|
||||
m_pInternal->wsSrcFile = L"";
|
||||
m_pInternal->wsPassword = owner_password;
|
||||
return m_pInternal->pReader->LoadFromMemory(data, length, L"", owner_password, user_password) && (m_pInternal->pReader->GetError() == 0);
|
||||
return m_pInternal->pReader->LoadFromMemory(m_pInternal->pAppFonts, data, length, owner_password, user_password) && (m_pInternal->pReader->GetError() == 0);
|
||||
}
|
||||
void CPdfFile::Close()
|
||||
{
|
||||
@ -667,7 +670,7 @@ void CPdfFile::Close()
|
||||
}
|
||||
NSFonts::IApplicationFonts* CPdfFile::GetFonts()
|
||||
{
|
||||
return m_pInternal->pReader->GetFonts();
|
||||
return m_pInternal->pAppFonts;
|
||||
}
|
||||
OfficeDrawingFileType CPdfFile::GetType()
|
||||
{
|
||||
@ -691,13 +694,12 @@ void CPdfFile::GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, do
|
||||
}
|
||||
void CPdfFile::DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak)
|
||||
{
|
||||
m_pInternal->pReader->DrawPageOnRenderer(this, nPageIndex, pBreak);
|
||||
m_pInternal->pReader->DrawPageOnRenderer(pRenderer, nPageIndex, pBreak);
|
||||
}
|
||||
std::wstring CPdfFile::GetInfo()
|
||||
{
|
||||
return m_pInternal->pReader->GetInfo();
|
||||
}
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
BYTE* CPdfFile::GetStructure()
|
||||
{
|
||||
return m_pInternal->pReader->GetStructure();
|
||||
@ -706,7 +708,6 @@ BYTE* CPdfFile::GetLinks(int nPageIndex)
|
||||
{
|
||||
return m_pInternal->pReader->GetLinks(nPageIndex);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@ -1085,7 +1086,7 @@ HRESULT CPdfFile::PathCommandEnd()
|
||||
}
|
||||
HRESULT CPdfFile::DrawPath(const LONG& lType)
|
||||
{
|
||||
return m_pInternal->pWriter->DrawPath(lType);
|
||||
return m_pInternal->pWriter->DrawPath(m_pInternal->pAppFonts, lType);
|
||||
}
|
||||
HRESULT CPdfFile::PathCommandStart()
|
||||
{
|
||||
@ -1117,7 +1118,7 @@ HRESULT CPdfFile::DrawImage(IGrObject* pImage, const double& dX, const double& d
|
||||
}
|
||||
HRESULT CPdfFile::DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha)
|
||||
{
|
||||
return m_pInternal->pWriter->DrawImageFromFile(wsImagePath, dX, dY, dW, dH, nAlpha);
|
||||
return m_pInternal->pWriter->DrawImageFromFile(m_pInternal->pAppFonts, wsImagePath, dX, dY, dW, dH, nAlpha);
|
||||
}
|
||||
HRESULT CPdfFile::SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY)
|
||||
{
|
||||
@ -1161,5 +1162,159 @@ HRESULT CPdfFile::AddLink(const double& dX, const double& dY, const double& dW,
|
||||
}
|
||||
HRESULT CPdfFile::AddFormField(const CFormFieldInfo& oInfo)
|
||||
{
|
||||
return m_pInternal->pWriter->AddFormField(oInfo);
|
||||
return m_pInternal->pWriter->AddFormField(m_pInternal->pAppFonts, oInfo);
|
||||
}
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
CPdfWriter::CPdfWriter(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA) : m_oCommandManager(this) {}
|
||||
CPdfWriter::~CPdfWriter() {}
|
||||
int CPdfWriter::SaveToFile(const std::wstring& wsPath) { return 0; }
|
||||
void CPdfWriter::SetPassword(const std::wstring& wsPassword) {}
|
||||
void CPdfWriter::SetDocumentID(const std::wstring& wsDocumentID) {}
|
||||
void CPdfWriter::SetTempFolder(const std::wstring& wsPath) {}
|
||||
std::wstring CPdfWriter::GetTempDirectory() { return std::wstring(); }
|
||||
std::wstring CPdfWriter::GetTempFile() { return std::wstring(); }
|
||||
HRESULT CPdfWriter::get_Type(LONG* lType) { return 0; }
|
||||
HRESULT CPdfWriter::NewPage() { return 0; }
|
||||
HRESULT CPdfWriter::get_Height(double* dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::put_Height(const double& dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::get_Width(double* dWidth) { return 0; }
|
||||
HRESULT CPdfWriter::put_Width(const double& dWidth) { return 0; }
|
||||
HRESULT CPdfWriter::get_DpiX(double* dDpiX) { return 0; }
|
||||
HRESULT CPdfWriter::get_DpiY(double* dDpiY) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenColor(LONG* lColor) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenColor(const LONG& lColor) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenAlpha(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenAlpha(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenSize(double* dSize) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenSize(const double& dSize) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenDashStyle(BYTE* nDashStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenDashStyle(const BYTE& nDashStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenLineStartCap(BYTE* nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenLineStartCap(const BYTE& nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenLineEndCap(BYTE* nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenLineEndCap(const BYTE& nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenLineJoin(BYTE* nJoinStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenLineJoin(const BYTE& nJoinStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenDashOffset(double* dOffset) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenDashOffset(const double& dOffset) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenAlign(LONG* lAlign) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenAlign(const LONG& lAlign) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenMiterLimit(double* dMiter) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenMiterLimit(const double& dMiter) { return 0; }
|
||||
HRESULT CPdfWriter::PenDashPattern(double* pPattern, LONG lCount) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushType(LONG* lType) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushType(const LONG& lType) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushColor1(LONG* lColor) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushColor1(const LONG& lColor) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushAlpha1(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushAlpha1(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushColor2(LONG* lColor) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushColor2(const LONG& lColor) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushAlpha2(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushAlpha2(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTexturePath(std::wstring* wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTexturePath(const std::wstring& wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTextureMode(LONG* lMode) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTextureMode(const LONG& lMode) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTextureAlpha(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTextureAlpha(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushLinearAngle(double* dAngle) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushLinearAngle(const double& dAngle) { return 0; }
|
||||
HRESULT CPdfWriter::BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontName(std::wstring* wsName) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontName(const std::wstring& wsName) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontPath(std::wstring* wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontPath(const std::wstring& wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontSize(double* dSize) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontSize(const double& dSize) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontStyle(LONG* lStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontStyle(const LONG& lStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontStringGID(INT* bGid) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontStringGID(const INT& bGid) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontCharSpace(double* dSpace) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontCharSpace(const double& dSpace) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontFaceIndex(int* lFaceIndex) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontFaceIndex(const int& lFaceIndex) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextCHAR2 (unsigned int* unUnicode, const unsigned int& unUnicodeCount, const unsigned int& unGid, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::BeginCommand(const DWORD& lType) { return 0; }
|
||||
HRESULT CPdfWriter::EndCommand(const DWORD& lType) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandMoveTo(const double& dX, const double& dY) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandLineTo(const double& dX, const double& dY) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandLinesTo(double* pPoints, const int& nCount) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandCurvesTo(double* pPoints, const int& nCount) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandClose() { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandEnd() { return 0; }
|
||||
HRESULT CPdfWriter::DrawPath(NSFonts::IApplicationFonts* pAppFonts, const LONG& lType) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandStart() { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandGetCurrentPoint(double* dX, double* dY) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY) { return 0; }
|
||||
HRESULT CPdfWriter::GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY) { return 0; }
|
||||
HRESULT CPdfWriter::ResetTransform() { return 0; }
|
||||
HRESULT CPdfWriter::get_ClipMode(LONG* lMode) { return 0; }
|
||||
HRESULT CPdfWriter::put_ClipMode(const LONG& lMode) { return 0; }
|
||||
HRESULT CPdfWriter::CommandLong(const LONG& lType, const LONG& lCommand) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDouble(const LONG& lType, const double& dCommand) { return 0; }
|
||||
HRESULT CPdfWriter::CommandString(const LONG& lType, const std::wstring& sCommand) { return 0; }
|
||||
HRESULT CPdfWriter::AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip) { return 0; }
|
||||
HRESULT CPdfWriter::AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage) { return 0; }
|
||||
HRESULT CPdfWriter::AddFormField(NSFonts::IApplicationFonts* pAppFonts, const CFormFieldInfo& oInfo) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextPdf(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const std::wstring& wsSrcCodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextPdf(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const std::wstring& bsSrcCodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImage1bpp(NSImages::CPixJbig2* pImageBuffer, const unsigned int& unWidth, const unsigned int& unHeight, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::EnableBrushRect(const LONG& lEnable) { return 0; }
|
||||
HRESULT CPdfWriter::SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2) { return 0; }
|
||||
HRESULT CPdfWriter::SetRadialGradient(const double& dX1, const double& dY1, const double& dR1, const double& dX2, const double& dY2, const double& dR2) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbig2* pMaskBuffer, const unsigned int& unMaskWidth, const unsigned int& unMaskHeight, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
std::pair<int, int> CPdfWriter::GetPageRef(int nPageIndex) { return std::make_pair(0, 0); }
|
||||
bool CPdfWriter::EditPage(PdfWriter::CPage* pNewPage) { return false; }
|
||||
bool CPdfWriter::AddPage(int nPageIndex) { return false; }
|
||||
bool CPdfWriter::DeletePage(int nPageIndex) { return false; }
|
||||
bool CPdfWriter::EditClose() { return false; }
|
||||
void CPdfWriter::PageRotate(int nRotate) {}
|
||||
void CPdfWriter::Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate) {}
|
||||
std::wstring CPdfWriter::GetEditPdfPath() { return std::wstring(); }
|
||||
PdfWriter::CImageDict* CPdfWriter::LoadImage(Aggplus::CImage* pImage, const BYTE& nAlpha) { return NULL; }
|
||||
bool CPdfWriter::DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha) { return false; }
|
||||
bool CPdfWriter::DrawText(unsigned char* pCodes, const unsigned int& unLen, const double& dX, const double& dY) { return false; }
|
||||
bool CPdfWriter::PathCommandDrawText(unsigned int* pUnicodes, unsigned int unLen, const double& dX, const double& dY, const unsigned int* pGids) { return false; }
|
||||
void CPdfWriter::UpdateFont() {}
|
||||
void CPdfWriter::GetFontPath(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, std::wstring& wsFontPath, LONG& lFaceIndex) {}
|
||||
PdfWriter::CFontCidTrueType* CPdfWriter::GetFont(const std::wstring& wsFontPath, const LONG& lFontIndex) { return NULL; }
|
||||
PdfWriter::CFontCidTrueType* CPdfWriter::GetFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic) { return NULL; }
|
||||
void CPdfWriter::UpdateTransform() {}
|
||||
void CPdfWriter::UpdatePen() {}
|
||||
void CPdfWriter::UpdateBrush(NSFonts::IApplicationFonts* pAppFonts) {}
|
||||
void CPdfWriter::Reset() {}
|
||||
bool CPdfWriter::IsValid() { return false; }
|
||||
bool CPdfWriter::IsPageValid() { return false; }
|
||||
void CPdfWriter::SetError() {}
|
||||
void CPdfWriter::AddLink(PdfWriter::CPage* pPage, const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const unsigned int& unDestPage) {}
|
||||
unsigned char* CPdfWriter::EncodeString(const unsigned int* pUnicodes, const unsigned int& unUnicodesCount, const unsigned int* pGIDs) { return NULL; }
|
||||
unsigned char* CPdfWriter::EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount) { return NULL; }
|
||||
std::wstring CPdfWriter::GetDownloadFile(const std::wstring& sUrl) { return std::wstring(); }
|
||||
|
||||
CPdfWriter::CCommandManager::CCommandManager(CPdfWriter* pRenderer) {}
|
||||
CPdfWriter::CCommandManager::~CCommandManager() {}
|
||||
CRendererTextCommand* CPdfWriter::CCommandManager::AddText(unsigned char* pCodes, unsigned int nLen, const double& dX, const double& dY) {}
|
||||
void CPdfWriter::CCommandManager::Flush() {}
|
||||
void CPdfWriter::CCommandManager::SetTransform(const CTransform& oTransform) {}
|
||||
void CPdfWriter::CCommandManager::SetTransform(const double& m11, const double& m12, const double& m21, const double& m22, const double& dx, const double& dy) {}
|
||||
void CPdfWriter::CCommandManager::Add(CRendererCommandBase* pCommand) {}
|
||||
void CPdfWriter::CCommandManager::Clear() {}
|
||||
void CPdfWriter::CBrushState::Reset() {}
|
||||
#endif
|
||||
|
||||
@ -119,11 +119,8 @@ public:
|
||||
virtual void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
|
||||
virtual void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
|
||||
virtual std::wstring GetInfo();
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
virtual BYTE* GetStructure();
|
||||
virtual BYTE* GetLinks(int nPageIndex);
|
||||
#endif
|
||||
|
||||
// --- WRITER ---
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,76 +34,47 @@
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
#include "../../DesktopEditor/graphics/IRenderer.h"
|
||||
#include "../../PdfReader/Src/RendererOutputDev.h"
|
||||
|
||||
class PDFDoc;
|
||||
namespace PdfReader
|
||||
class CPdfReader
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
errorNone = 0, // Нет ошибок
|
||||
errorOpenFile = 1, // Ошибка при открытии PDF файла
|
||||
errorBadCatalog = 2, // couldn't read the page catalog
|
||||
errorDamaged = 3, // PDF файл был поврежден и его невозможно восстановить
|
||||
errorEncrypted = 4, // Файл зашифрован, авторизация не пройдена
|
||||
errorHighlightFile = 5, // nonexistent or invalid highlight file
|
||||
errorBadPrinter = 6, // плохой принтер
|
||||
errorPrinting = 7, // ошибка во время печати
|
||||
errorPermission = 8, // Ошибка связанная с ограничениями наложенными на файл
|
||||
errorBadPageNum = 9, // Неверное количество страниц
|
||||
errorFileIO = 10, // Ошибка при чтении/записи
|
||||
errorMemory = 11 // Memory exceed
|
||||
} EError;
|
||||
public:
|
||||
|
||||
class CPdfReader_Private;
|
||||
class CPdfReader
|
||||
{
|
||||
public:
|
||||
CPdfReader(NSFonts::IApplicationFonts* pAppFonts);
|
||||
~CPdfReader();
|
||||
|
||||
CPdfReader(NSFonts::IApplicationFonts* fonts);
|
||||
~CPdfReader();
|
||||
bool LoadFromFile (NSFonts::IApplicationFonts* pAppFonts, const std::wstring& file, const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
|
||||
bool LoadFromMemory(NSFonts::IApplicationFonts* pAppFonts, BYTE* data, DWORD length, const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
|
||||
|
||||
bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
|
||||
bool LoadFromMemory(BYTE* data, DWORD length, const std::wstring& options = L"",
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
|
||||
void Close();
|
||||
|
||||
void Close();
|
||||
std::wstring GetTempDirectory();
|
||||
void SetTempDirectory(const std::wstring& directory);
|
||||
|
||||
NSFonts::IApplicationFonts* GetFonts();
|
||||
int GetPagesCount();
|
||||
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
|
||||
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
|
||||
std::wstring GetInfo();
|
||||
|
||||
std::wstring GetTempDirectory();
|
||||
void SetTempDirectory(const std::wstring& directory);
|
||||
int GetError();
|
||||
double GetVersion();
|
||||
|
||||
int GetPagesCount();
|
||||
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
|
||||
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
|
||||
std::wstring GetInfo();
|
||||
NSFonts::IFontManager* GetFontManager() { return m_pFontManager; }
|
||||
PDFDoc* GetPDFDocument() { return m_pPDFDocument; }
|
||||
void ChangeLength(DWORD nLength);
|
||||
|
||||
int GetError();
|
||||
double GetVersion();
|
||||
int GetPermissions();
|
||||
std::wstring GetPageLabel(int nPageIndex);
|
||||
BYTE* GetStructure();
|
||||
BYTE* GetLinks(int nPageIndex);
|
||||
|
||||
bool ExtractAllImages(const wchar_t* wsDstPath, const wchar_t* wsPrefix = 0);
|
||||
int GetImagesCount();
|
||||
|
||||
void SetCMapFolder(const wchar_t* wsCMapFolder);
|
||||
void SetCMapMemory();
|
||||
NSFonts::IFontManager* GetFontManager();
|
||||
|
||||
std::wstring ToXml(const std::wstring& wsXmlPath, bool isPrintStreams = false);
|
||||
PDFDoc* GetPDFDocument();
|
||||
void ChangeLength(DWORD nLength);
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
BYTE* GetStructure();
|
||||
BYTE* GetLinks(int nPageIndex);
|
||||
#endif
|
||||
|
||||
private:
|
||||
CPdfReader_Private* m_pInternal;
|
||||
int m_eError;
|
||||
};
|
||||
}
|
||||
private:
|
||||
PDFDoc* m_pPDFDocument;
|
||||
std::wstring m_wsTempFolder;
|
||||
std::wstring m_wsSrcPath;
|
||||
NSFonts::IFontManager* m_pFontManager;
|
||||
PdfReader::CFontList* m_pFontList;
|
||||
DWORD m_nFileLength;
|
||||
int m_eError;
|
||||
};
|
||||
|
||||
#endif // _PDF_READER_H
|
||||
|
||||
@ -493,15 +493,13 @@ void CPdfWriter::CCommandManager::SetTransform(const double& m11, const double&
|
||||
//----------------------------------------------------------------------------------------
|
||||
CPdfWriter::CPdfWriter(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA) : m_oCommandManager(this)
|
||||
{
|
||||
m_pAppFonts = pAppFonts;
|
||||
|
||||
// Создаем менеджер шрифтов с собственным кэшем
|
||||
m_pFontManager = pAppFonts->GenerateFontManager();
|
||||
// Создаем менеджер шрифтов с собственным кэшем
|
||||
m_pFontManager = pAppFonts->GenerateFontManager();
|
||||
NSFonts::IFontsCache* pMeasurerCache = NSFonts::NSFontCache::Create();
|
||||
pMeasurerCache->SetStreams(pAppFonts->GetStreams());
|
||||
m_pFontManager->SetOwnerCache(pMeasurerCache);
|
||||
pMeasurerCache->SetStreams(pAppFonts->GetStreams());
|
||||
m_pFontManager->SetOwnerCache(pMeasurerCache);
|
||||
|
||||
m_pDocument = new CDocument();
|
||||
m_pDocument = new CDocument();
|
||||
|
||||
if (isPDFA)
|
||||
m_pDocument->SetPDFAConformanceMode(true);
|
||||
@ -532,7 +530,7 @@ CPdfWriter::CPdfWriter(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA) : m_o
|
||||
CPdfWriter::~CPdfWriter()
|
||||
{
|
||||
RELEASEOBJECT(m_pDocument);
|
||||
RELEASEINTERFACE(m_pFontManager);
|
||||
RELEASEINTERFACE(m_pFontManager);
|
||||
|
||||
if (L"" != m_wsTempFolder)
|
||||
NSDirectory::DeleteDirectory(m_wsTempFolder);
|
||||
@ -1105,7 +1103,7 @@ HRESULT CPdfWriter::CommandDrawTextEx(const std::wstring& wsUnicodeText, const u
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
unsigned char* pCodes = EncodeString(pUnicodes, unLen, pGids);
|
||||
unsigned char* pCodes = EncodeString(pUnicodes, unLen, pGids);
|
||||
RELEASEARRAYOBJECTS(pUnicodes);
|
||||
return DrawText(pCodes, unLen * 2, dX, dY) ? S_OK : S_FALSE;
|
||||
}
|
||||
@ -1182,7 +1180,7 @@ HRESULT CPdfWriter::PathCommandEnd()
|
||||
m_oPath.Clear();
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CPdfWriter::DrawPath(const LONG& lType)
|
||||
HRESULT CPdfWriter::DrawPath(NSFonts::IApplicationFonts* pAppFonts, const LONG& lType)
|
||||
{
|
||||
m_oCommandManager.Flush();
|
||||
|
||||
@ -1213,7 +1211,7 @@ HRESULT CPdfWriter::DrawPath(const LONG& lType)
|
||||
m_oBrush.SetTexturePath(sTextureTmpPath);
|
||||
}
|
||||
|
||||
UpdateBrush();
|
||||
UpdateBrush(pAppFonts);
|
||||
}
|
||||
|
||||
if (!m_pShading)
|
||||
@ -1318,7 +1316,7 @@ HRESULT CPdfWriter::PathCommandGetCurrentPoint(double* dX, double* dY)
|
||||
HRESULT CPdfWriter::PathCommandTextCHAR(const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH)
|
||||
{
|
||||
unsigned int unUnicode = lUnicode;
|
||||
bool bRes = PathCommandDrawText(&unUnicode, 1, dX, dY, NULL);
|
||||
bool bRes = PathCommandDrawText(&unUnicode, 1, dX, dY, NULL);
|
||||
return bRes ? S_OK : S_FALSE;
|
||||
}
|
||||
HRESULT CPdfWriter::PathCommandText(const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH)
|
||||
@ -1328,7 +1326,7 @@ HRESULT CPdfWriter::PathCommandText(const std::wstring& wsUnicodeText, const dou
|
||||
if (!pUnicodes)
|
||||
return S_FALSE;
|
||||
|
||||
PathCommandDrawText(pUnicodes, unLen, dX, dY, NULL);
|
||||
PathCommandDrawText(pUnicodes, unLen, dX, dY, NULL);
|
||||
delete[] pUnicodes;
|
||||
|
||||
return S_OK;
|
||||
@ -1337,7 +1335,7 @@ HRESULT CPdfWriter::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid
|
||||
{
|
||||
unsigned int unUnicode = lUnicode;
|
||||
unsigned int unGid = lGid;
|
||||
bool bRes = PathCommandDrawText(&unUnicode, 1, dX, dY, &unGid);
|
||||
bool bRes = PathCommandDrawText(&unUnicode, 1, dX, dY, &unGid);
|
||||
return bRes ? S_OK : S_FALSE;
|
||||
}
|
||||
HRESULT CPdfWriter::PathCommandTextEx(const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int unGidsCount, const double& dX, const double& dY, const double& dW, const double& dH)
|
||||
@ -1375,7 +1373,7 @@ HRESULT CPdfWriter::PathCommandTextEx(const std::wstring& wsUnicodeText, const u
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
bool bRes = PathCommandDrawText(pUnicodes, unLen, dX, dY, pGids);
|
||||
bool bRes = PathCommandDrawText(pUnicodes, unLen, dX, dY, pGids);
|
||||
RELEASEARRAYOBJECTS(pUnicodes);
|
||||
|
||||
return bRes ? S_OK : S_FALSE;
|
||||
@ -1395,7 +1393,7 @@ HRESULT CPdfWriter::DrawImage(IGrObject* pImage, const double& dX, const double&
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CPdfWriter::DrawImageFromFile(const std::wstring& wsImagePathSrc, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha)
|
||||
HRESULT CPdfWriter::DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsImagePathSrc, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha)
|
||||
{
|
||||
m_oCommandManager.Flush();
|
||||
|
||||
@ -1414,7 +1412,7 @@ HRESULT CPdfWriter::DrawImageFromFile(const std::wstring& wsImagePathSrc, const
|
||||
_CXIMAGE_FORMAT_SVG == oImageFormat.eFileType)
|
||||
{
|
||||
// TODO: Реализовать отрисовку метафайлов по-нормальному
|
||||
MetaFile::IMetaFile* pMeta = MetaFile::Create(m_pAppFonts);
|
||||
MetaFile::IMetaFile* pMeta = MetaFile::Create(pAppFonts);
|
||||
pMeta->LoadFromFile(wsImagePath.c_str());
|
||||
|
||||
double dNewW = std::max(10.0, dW) / 25.4 * 300;
|
||||
@ -1520,14 +1518,14 @@ HRESULT CPdfWriter::AddLink(const double& dX, const double& dY, const double& dW
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CPdfWriter::AddFormField(const CFormFieldInfo &oInfo)
|
||||
HRESULT CPdfWriter::AddFormField(NSFonts::IApplicationFonts* pAppFonts, const CFormFieldInfo &oInfo)
|
||||
{
|
||||
unsigned int unPagesCount = m_pDocument->GetPagesCount();
|
||||
if (!m_pDocument || 0 == unPagesCount)
|
||||
return S_OK;
|
||||
|
||||
if (m_bNeedUpdateTextFont)
|
||||
UpdateFont();
|
||||
UpdateFont();
|
||||
|
||||
if (!m_pFont)
|
||||
return S_OK;
|
||||
@ -1651,8 +1649,8 @@ HRESULT CPdfWriter::AddFormField(const CFormFieldInfo &oInfo)
|
||||
|
||||
if (!m_pFont->HaveChar(unUnicode))
|
||||
{
|
||||
std::wstring wsFontFamily = m_pAppFonts->GetFontBySymbol(unUnicode);
|
||||
CFontCidTrueType* pTempFont = GetFont(wsFontFamily, isBold, isItalic);
|
||||
std::wstring wsFontFamily = pAppFonts->GetFontBySymbol(unUnicode);
|
||||
CFontCidTrueType* pTempFont = GetFont(wsFontFamily, isBold, isItalic);
|
||||
if (pTempFont)
|
||||
{
|
||||
pCodes[unIndex] = pTempFont->EncodeUnicode(unUnicode);
|
||||
@ -1863,8 +1861,8 @@ HRESULT CPdfWriter::AddFormField(const CFormFieldInfo &oInfo)
|
||||
|
||||
if (!m_pFont->HaveChar(unUnicode))
|
||||
{
|
||||
std::wstring wsFontFamily = m_pAppFonts->GetFontBySymbol(unUnicode);
|
||||
CFontCidTrueType* pTempFont = GetFont(wsFontFamily, isBold, isItalic);
|
||||
std::wstring wsFontFamily = pAppFonts->GetFontBySymbol(unUnicode);
|
||||
CFontCidTrueType* pTempFont = GetFont(wsFontFamily, isBold, isItalic);
|
||||
if (pTempFont)
|
||||
{
|
||||
pCodes[unIndex] = pTempFont->EncodeUnicode(unUnicode);
|
||||
@ -1944,8 +1942,8 @@ HRESULT CPdfWriter::AddFormField(const CFormFieldInfo &oInfo)
|
||||
pFieldBase->AddPageRect(m_pPage, TRect(MM_2_PT(dX), m_pPage->GetHeight() - MM_2_PT(dY), MM_2_PT(dX + dW), m_pPage->GetHeight() - MM_2_PT(dY + dH)));
|
||||
pField->SetValue(pPr->IsChecked());
|
||||
|
||||
CFontCidTrueType* pCheckedFont = GetFont(pPr->GetCheckedFontName(), false, false);
|
||||
CFontCidTrueType* pUncheckedFont = GetFont(pPr->GetUncheckedFontName(), false, false);
|
||||
CFontCidTrueType* pCheckedFont = GetFont(pPr->GetCheckedFontName(), false, false);
|
||||
CFontCidTrueType* pUncheckedFont = GetFont(pPr->GetUncheckedFontName(), false, false);
|
||||
if (!pCheckedFont)
|
||||
pCheckedFont = m_pFont;
|
||||
|
||||
@ -2166,11 +2164,6 @@ std::wstring CPdfWriter::GetEditPdfPath()
|
||||
{
|
||||
return m_pDocument->GetEditPdfPath();
|
||||
}
|
||||
|
||||
NSFonts::IApplicationFonts* CPdfWriter::GetApplicationFonts()
|
||||
{
|
||||
return m_pAppFonts;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Внутренние функции
|
||||
//----------------------------------------------------------------------------------------
|
||||
@ -2302,7 +2295,7 @@ bool CPdfWriter::DrawText(unsigned char* pCodes, const unsigned int& unLen, cons
|
||||
}
|
||||
bool CPdfWriter::PathCommandDrawText(unsigned int* pUnicodes, unsigned int unLen, const double& dX, const double& dY, const unsigned int* pGids)
|
||||
{
|
||||
unsigned char* pCodes = EncodeString(pUnicodes, unLen, pGids);
|
||||
unsigned char* pCodes = EncodeString(pUnicodes, unLen, pGids);
|
||||
if (!pCodes)
|
||||
return false;
|
||||
|
||||
@ -2315,7 +2308,7 @@ void CPdfWriter::UpdateFont()
|
||||
std::wstring wsFontPath = m_oFont.GetPath();
|
||||
LONG lFaceIndex = m_oFont.GetFaceIndex();
|
||||
if (L"" == wsFontPath)
|
||||
GetFontPath(m_oFont.GetName(), m_oFont.IsBold(), m_oFont.IsItalic(), wsFontPath, lFaceIndex);
|
||||
GetFontPath(m_oFont.GetName(), m_oFont.IsBold(), m_oFont.IsItalic(), wsFontPath, lFaceIndex);
|
||||
|
||||
m_oFont.SetNeedDoBold(false);
|
||||
m_oFont.SetNeedDoItalic(false);
|
||||
@ -2323,7 +2316,7 @@ void CPdfWriter::UpdateFont()
|
||||
m_pFont = NULL;
|
||||
if (L"" != wsFontPath)
|
||||
{
|
||||
m_pFont = GetFont(wsFontPath, lFaceIndex);
|
||||
m_pFont = GetFont(wsFontPath, lFaceIndex);
|
||||
if (m_pFont)
|
||||
{
|
||||
if (m_oFont.IsItalic() && !m_pFont->IsItalic())
|
||||
@ -2355,7 +2348,7 @@ void CPdfWriter::GetFontPath(const std::wstring &wsFontName, const bool &bBold,
|
||||
oFontSelect.wsName = new std::wstring(wsFontName);
|
||||
oFontSelect.bItalic = new INT(bItalic ? 1 : 0);
|
||||
oFontSelect.bBold = new INT(bBold ? 1 : 0);
|
||||
NSFonts::CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect, false);
|
||||
NSFonts::CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect, false);
|
||||
if (!NSFonts::CFontInfo::CanEmbedForPreviewAndPrint(pFontInfo->m_usType))
|
||||
{
|
||||
oFontSelect.Fill(pFontInfo);
|
||||
@ -2364,7 +2357,7 @@ void CPdfWriter::GetFontPath(const std::wstring &wsFontName, const bool &bBold,
|
||||
else
|
||||
oFontSelect.usType = new USHORT(NSFONTS_EMBEDDING_RIGHTS_PRINT_AND_PREVIEW);
|
||||
|
||||
pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect, false);
|
||||
pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect, false);
|
||||
}
|
||||
|
||||
wsFontPath = pFontInfo->m_wsFontPath;
|
||||
@ -2383,13 +2376,13 @@ PdfWriter::CFontCidTrueType* CPdfWriter::GetFont(const std::wstring& wsFontPath,
|
||||
return pFont;
|
||||
|
||||
// TODO: Пока мы здесь предполагаем, что шрифты только либо TrueType, либо OpenType
|
||||
if (!m_pFontManager->LoadFontFromFile(wsFontPath, lFaceIndex, 10, 72, 72))
|
||||
if (!m_pFontManager->LoadFontFromFile(wsFontPath, lFaceIndex, 10, 72, 72))
|
||||
{
|
||||
std::wcout << L"PDF Writer: Can't load fontfile " << wsFontPath.c_str() << "\n";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::wstring wsFontType = m_pFontManager->GetFontType();
|
||||
std::wstring wsFontType = m_pFontManager->GetFontType();
|
||||
if (L"TrueType" == wsFontType || L"OpenType" == wsFontType || L"CFF" == wsFontType)
|
||||
pFont = m_pDocument->CreateCidTrueTypeFont(wsFontPath, lFaceIndex);
|
||||
}
|
||||
@ -2401,8 +2394,8 @@ PdfWriter::CFontCidTrueType* CPdfWriter::GetFont(const std::wstring& wsFontName,
|
||||
std::wstring wsFontPath;
|
||||
LONG lFaceIndex;
|
||||
|
||||
GetFontPath(wsFontName, bBold, bItalic, wsFontPath, lFaceIndex);
|
||||
return GetFont(wsFontPath, lFaceIndex);
|
||||
GetFontPath(wsFontName, bBold, bItalic, wsFontPath, lFaceIndex);
|
||||
return GetFont(wsFontPath, lFaceIndex);
|
||||
}
|
||||
void CPdfWriter::UpdateTransform()
|
||||
{
|
||||
@ -2469,7 +2462,7 @@ void CPdfWriter::UpdatePen()
|
||||
else
|
||||
m_pPage->SetLineJoin(linejoin_Round);
|
||||
}
|
||||
void CPdfWriter::UpdateBrush()
|
||||
void CPdfWriter::UpdateBrush(NSFonts::IApplicationFonts* pAppFonts)
|
||||
{
|
||||
m_pShading = NULL;
|
||||
m_pShadingExtGrState = NULL;
|
||||
@ -2505,7 +2498,7 @@ void CPdfWriter::UpdateBrush()
|
||||
_CXIMAGE_FORMAT_SVG == oImageFormat.eFileType)
|
||||
{
|
||||
// TODO: Реализовать отрисовку метафайлов по-нормальному
|
||||
MetaFile::IMetaFile* pMeta = MetaFile::Create(m_pAppFonts);
|
||||
MetaFile::IMetaFile* pMeta = MetaFile::Create(pAppFonts);
|
||||
pMeta->LoadFromFile(wsTexturePath.c_str());
|
||||
|
||||
double dL, dR, dT, dB;
|
||||
@ -2858,7 +2851,7 @@ void CPdfWriter::SetError()
|
||||
unsigned char* CPdfWriter::EncodeString(const unsigned int *pUnicodes, const unsigned int& unCount, const unsigned int *pGIDs)
|
||||
{
|
||||
if (m_bNeedUpdateTextFont)
|
||||
UpdateFont();
|
||||
UpdateFont();
|
||||
|
||||
if (!m_pFont)
|
||||
return NULL;
|
||||
@ -2884,7 +2877,7 @@ unsigned char* CPdfWriter::EncodeString(const unsigned int *pUnicodes, const uns
|
||||
unsigned char* CPdfWriter::EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount)
|
||||
{
|
||||
if (m_bNeedUpdateTextFont)
|
||||
UpdateFont();
|
||||
UpdateFont();
|
||||
|
||||
if (!m_pFont)
|
||||
return NULL;
|
||||
|
||||
@ -77,138 +77,138 @@ public:
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Тип рендерера
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_Type(LONG* lType);
|
||||
HRESULT get_Type(LONG* lType);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для работы со страницей
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT NewPage();
|
||||
virtual HRESULT get_Height(double* dHeight);
|
||||
virtual HRESULT put_Height(const double& dHeight);
|
||||
virtual HRESULT get_Width(double* dWidth);
|
||||
virtual HRESULT put_Width(const double& dWidth);
|
||||
virtual HRESULT get_DpiX(double* dDpiX);
|
||||
virtual HRESULT get_DpiY(double* dDpiY);
|
||||
HRESULT NewPage();
|
||||
HRESULT get_Height(double* dHeight);
|
||||
HRESULT put_Height(const double& dHeight);
|
||||
HRESULT get_Width(double* dWidth);
|
||||
HRESULT put_Width(const double& dWidth);
|
||||
HRESULT get_DpiX(double* dDpiX);
|
||||
HRESULT get_DpiY(double* dDpiY);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для работы с Pen
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_PenColor(LONG* lColor);
|
||||
virtual HRESULT put_PenColor(const LONG& lColor);
|
||||
virtual HRESULT get_PenAlpha(LONG* lAlpha);
|
||||
virtual HRESULT put_PenAlpha(const LONG& lAlpha);
|
||||
virtual HRESULT get_PenSize(double* dSize);
|
||||
virtual HRESULT put_PenSize(const double& dSize);
|
||||
virtual HRESULT get_PenDashStyle(BYTE* nDashStyle);
|
||||
virtual HRESULT put_PenDashStyle(const BYTE& nDashStyle);
|
||||
virtual HRESULT get_PenLineStartCap(BYTE* nCapStyle);
|
||||
virtual HRESULT put_PenLineStartCap(const BYTE& nCapStyle);
|
||||
virtual HRESULT get_PenLineEndCap(BYTE* nCapStyle);
|
||||
virtual HRESULT put_PenLineEndCap(const BYTE& nCapStyle);
|
||||
virtual HRESULT get_PenLineJoin(BYTE* nJoinStyle);
|
||||
virtual HRESULT put_PenLineJoin(const BYTE& nJoinStyle);
|
||||
virtual HRESULT get_PenDashOffset(double* dOffset);
|
||||
virtual HRESULT put_PenDashOffset(const double& dOffset);
|
||||
virtual HRESULT get_PenAlign(LONG* lAlign);
|
||||
virtual HRESULT put_PenAlign(const LONG& lAlign);
|
||||
virtual HRESULT get_PenMiterLimit(double* dMiter);
|
||||
virtual HRESULT put_PenMiterLimit(const double& dMiter);
|
||||
virtual HRESULT PenDashPattern(double* pPattern, LONG lCount);
|
||||
HRESULT get_PenColor(LONG* lColor);
|
||||
HRESULT put_PenColor(const LONG& lColor);
|
||||
HRESULT get_PenAlpha(LONG* lAlpha);
|
||||
HRESULT put_PenAlpha(const LONG& lAlpha);
|
||||
HRESULT get_PenSize(double* dSize);
|
||||
HRESULT put_PenSize(const double& dSize);
|
||||
HRESULT get_PenDashStyle(BYTE* nDashStyle);
|
||||
HRESULT put_PenDashStyle(const BYTE& nDashStyle);
|
||||
HRESULT get_PenLineStartCap(BYTE* nCapStyle);
|
||||
HRESULT put_PenLineStartCap(const BYTE& nCapStyle);
|
||||
HRESULT get_PenLineEndCap(BYTE* nCapStyle);
|
||||
HRESULT put_PenLineEndCap(const BYTE& nCapStyle);
|
||||
HRESULT get_PenLineJoin(BYTE* nJoinStyle);
|
||||
HRESULT put_PenLineJoin(const BYTE& nJoinStyle);
|
||||
HRESULT get_PenDashOffset(double* dOffset);
|
||||
HRESULT put_PenDashOffset(const double& dOffset);
|
||||
HRESULT get_PenAlign(LONG* lAlign);
|
||||
HRESULT put_PenAlign(const LONG& lAlign);
|
||||
HRESULT get_PenMiterLimit(double* dMiter);
|
||||
HRESULT put_PenMiterLimit(const double& dMiter);
|
||||
HRESULT PenDashPattern(double* pPattern, LONG lCount);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для работы с Brush
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_BrushType(LONG* lType);
|
||||
virtual HRESULT put_BrushType(const LONG& lType);
|
||||
virtual HRESULT get_BrushColor1(LONG* lColor);
|
||||
virtual HRESULT put_BrushColor1(const LONG& lColor);
|
||||
virtual HRESULT get_BrushAlpha1(LONG* lAlpha);
|
||||
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha);
|
||||
virtual HRESULT get_BrushColor2(LONG* lColor);
|
||||
virtual HRESULT put_BrushColor2(const LONG& lColor);
|
||||
virtual HRESULT get_BrushAlpha2(LONG* lAlpha);
|
||||
virtual HRESULT put_BrushAlpha2(const LONG& lAlpha);
|
||||
virtual HRESULT get_BrushTexturePath(std::wstring* wsPath);
|
||||
virtual HRESULT put_BrushTexturePath(const std::wstring& wsPath);
|
||||
virtual HRESULT get_BrushTextureMode(LONG* lMode);
|
||||
virtual HRESULT put_BrushTextureMode(const LONG& lMode);
|
||||
virtual HRESULT get_BrushTextureAlpha(LONG* lAlpha);
|
||||
virtual HRESULT put_BrushTextureAlpha(const LONG& lAlpha);
|
||||
virtual HRESULT get_BrushLinearAngle(double* dAngle);
|
||||
virtual HRESULT put_BrushLinearAngle(const double& dAngle);
|
||||
virtual HRESULT BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||
virtual HRESULT BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||
virtual HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount);
|
||||
HRESULT get_BrushType(LONG* lType);
|
||||
HRESULT put_BrushType(const LONG& lType);
|
||||
HRESULT get_BrushColor1(LONG* lColor);
|
||||
HRESULT put_BrushColor1(const LONG& lColor);
|
||||
HRESULT get_BrushAlpha1(LONG* lAlpha);
|
||||
HRESULT put_BrushAlpha1(const LONG& lAlpha);
|
||||
HRESULT get_BrushColor2(LONG* lColor);
|
||||
HRESULT put_BrushColor2(const LONG& lColor);
|
||||
HRESULT get_BrushAlpha2(LONG* lAlpha);
|
||||
HRESULT put_BrushAlpha2(const LONG& lAlpha);
|
||||
HRESULT get_BrushTexturePath(std::wstring* wsPath);
|
||||
HRESULT put_BrushTexturePath(const std::wstring& wsPath);
|
||||
HRESULT get_BrushTextureMode(LONG* lMode);
|
||||
HRESULT put_BrushTextureMode(const LONG& lMode);
|
||||
HRESULT get_BrushTextureAlpha(LONG* lAlpha);
|
||||
HRESULT put_BrushTextureAlpha(const LONG& lAlpha);
|
||||
HRESULT get_BrushLinearAngle(double* dAngle);
|
||||
HRESULT put_BrushLinearAngle(const double& dAngle);
|
||||
HRESULT BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||
HRESULT BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||
HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для работы со шрифтами
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_FontName(std::wstring* wsName);
|
||||
virtual HRESULT put_FontName(const std::wstring& wsName);
|
||||
virtual HRESULT get_FontPath(std::wstring* wsPath);
|
||||
virtual HRESULT put_FontPath(const std::wstring& wsPath);
|
||||
virtual HRESULT get_FontSize(double* dSize);
|
||||
virtual HRESULT put_FontSize(const double& dSize);
|
||||
virtual HRESULT get_FontStyle(LONG* lStyle);
|
||||
virtual HRESULT put_FontStyle(const LONG& lStyle);
|
||||
virtual HRESULT get_FontStringGID(INT* bGid);
|
||||
virtual HRESULT put_FontStringGID(const INT& bGid);
|
||||
virtual HRESULT get_FontCharSpace(double* dSpace);
|
||||
virtual HRESULT put_FontCharSpace(const double& dSpace);
|
||||
virtual HRESULT get_FontFaceIndex(int* lFaceIndex);
|
||||
virtual HRESULT put_FontFaceIndex(const int& lFaceIndex);
|
||||
HRESULT get_FontName(std::wstring* wsName);
|
||||
HRESULT put_FontName(const std::wstring& wsName);
|
||||
HRESULT get_FontPath(std::wstring* wsPath);
|
||||
HRESULT put_FontPath(const std::wstring& wsPath);
|
||||
HRESULT get_FontSize(double* dSize);
|
||||
HRESULT put_FontSize(const double& dSize);
|
||||
HRESULT get_FontStyle(LONG* lStyle);
|
||||
HRESULT put_FontStyle(const LONG& lStyle);
|
||||
HRESULT get_FontStringGID(INT* bGid);
|
||||
HRESULT put_FontStringGID(const INT& bGid);
|
||||
HRESULT get_FontCharSpace(double* dSpace);
|
||||
HRESULT put_FontCharSpace(const double& dSpace);
|
||||
HRESULT get_FontFaceIndex(int* lFaceIndex);
|
||||
HRESULT put_FontFaceIndex(const int& lFaceIndex);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для вывода текста
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT CommandDrawTextCHAR2 (unsigned int* unUnicode, const unsigned int& unUnicodeCount, const unsigned int& unGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT CommandDrawTextCHAR2 (unsigned int* unUnicode, const unsigned int& unUnicodeCount, const unsigned int& unGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Маркеры команд
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType);
|
||||
virtual HRESULT EndCommand(const DWORD& lType);
|
||||
HRESULT BeginCommand(const DWORD& lType);
|
||||
HRESULT EndCommand(const DWORD& lType);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для работы с патом
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT PathCommandMoveTo(const double& dX, const double& dY);
|
||||
virtual HRESULT PathCommandLineTo(const double& dX, const double& dY);
|
||||
virtual HRESULT PathCommandLinesTo(double* pPoints, const int& nCount);
|
||||
virtual HRESULT PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe);
|
||||
virtual HRESULT PathCommandCurvesTo(double* pPoints, const int& nCount);
|
||||
virtual HRESULT PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle);
|
||||
virtual HRESULT PathCommandClose();
|
||||
virtual HRESULT PathCommandEnd();
|
||||
virtual HRESULT DrawPath(const LONG& lType);
|
||||
virtual HRESULT PathCommandStart();
|
||||
virtual HRESULT PathCommandGetCurrentPoint(double* dX, double* dY);
|
||||
virtual HRESULT PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT PathCommandMoveTo(const double& dX, const double& dY);
|
||||
HRESULT PathCommandLineTo(const double& dX, const double& dY);
|
||||
HRESULT PathCommandLinesTo(double* pPoints, const int& nCount);
|
||||
HRESULT PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe);
|
||||
HRESULT PathCommandCurvesTo(double* pPoints, const int& nCount);
|
||||
HRESULT PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle);
|
||||
HRESULT PathCommandClose();
|
||||
HRESULT PathCommandEnd();
|
||||
HRESULT DrawPath(NSFonts::IApplicationFonts* pAppFonts, const LONG& lType);
|
||||
HRESULT PathCommandStart();
|
||||
HRESULT PathCommandGetCurrentPoint(double* dX, double* dY);
|
||||
HRESULT PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для вывода изображений
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
virtual HRESULT DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
|
||||
HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
HRESULT DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Функции для выставления преобразования
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY);
|
||||
virtual HRESULT GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY);
|
||||
virtual HRESULT ResetTransform();
|
||||
HRESULT SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY);
|
||||
HRESULT GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY);
|
||||
HRESULT ResetTransform();
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Тип клипа
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_ClipMode(LONG* lMode);
|
||||
virtual HRESULT put_ClipMode(const LONG& lMode);
|
||||
HRESULT get_ClipMode(LONG* lMode);
|
||||
HRESULT put_ClipMode(const LONG& lMode);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Дополнительные функции
|
||||
//----------------------------------------------------------------------------------------
|
||||
virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand);
|
||||
virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand);
|
||||
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand);
|
||||
virtual HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip);
|
||||
virtual HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage);
|
||||
virtual HRESULT AddFormField(const CFormFieldInfo& oInfo);
|
||||
HRESULT CommandLong(const LONG& lType, const LONG& lCommand);
|
||||
HRESULT CommandDouble(const LONG& lType, const double& dCommand);
|
||||
HRESULT CommandString(const LONG& lType, const std::wstring& sCommand);
|
||||
HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip);
|
||||
HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage);
|
||||
HRESULT AddFormField(NSFonts::IApplicationFonts* pAppFonts, const CFormFieldInfo& oInfo);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Дополнительные функции Pdf рендерера
|
||||
//----------------------------------------------------------------------------------------
|
||||
@ -233,27 +233,25 @@ public:
|
||||
std::wstring GetEditPdfPath();
|
||||
PdfWriter::CDocument* GetPDFDocument() { return m_pDocument; }
|
||||
|
||||
NSFonts::IApplicationFonts* GetApplicationFonts();
|
||||
|
||||
private:
|
||||
PdfWriter::CImageDict* LoadImage(Aggplus::CImage* pImage, const BYTE& nAlpha);
|
||||
bool DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha);
|
||||
bool DrawText(unsigned char* pCodes, const unsigned int& unLen, const double& dX, const double& dY);
|
||||
bool PathCommandDrawText(unsigned int* pUnicodes, unsigned int unLen, const double& dX, const double& dY, const unsigned int* pGids = NULL);
|
||||
void UpdateFont();
|
||||
void GetFontPath(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, std::wstring& wsFontPath, LONG& lFaceIndex);
|
||||
PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontPath, const LONG& lFontIndex);
|
||||
PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic);
|
||||
bool PathCommandDrawText(unsigned int* pUnicodes, unsigned int unLen, const double& dX, const double& dY, const unsigned int* pGids = NULL);
|
||||
void UpdateFont();
|
||||
void GetFontPath(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, std::wstring& wsFontPath, LONG& lFaceIndex);
|
||||
PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontPath, const LONG& lFontIndex);
|
||||
PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic);
|
||||
void UpdateTransform();
|
||||
void UpdatePen();
|
||||
void UpdateBrush();
|
||||
void UpdateBrush(NSFonts::IApplicationFonts* pAppFonts);
|
||||
void Reset();
|
||||
bool IsValid();
|
||||
bool IsPageValid();
|
||||
void SetError();
|
||||
void AddLink(PdfWriter::CPage* pPage, const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const unsigned int& unDestPage);
|
||||
unsigned char* EncodeString(const unsigned int* pUnicodes, const unsigned int& unUnicodesCount, const unsigned int* pGIDs = NULL);
|
||||
unsigned char* EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount);
|
||||
unsigned char* EncodeString(const unsigned int* pUnicodes, const unsigned int& unUnicodesCount, const unsigned int* pGIDs = NULL);
|
||||
unsigned char* EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount);
|
||||
std::wstring GetDownloadFile(const std::wstring& sUrl);
|
||||
|
||||
private:
|
||||
@ -1825,9 +1823,7 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
NSFonts::IApplicationFonts* m_pAppFonts;
|
||||
NSFonts::IFontManager* m_pFontManager;
|
||||
NSFonts::IFontManager* m_pFontManager;
|
||||
std::wstring m_wsTempFolder;
|
||||
|
||||
PdfWriter::CDocument* m_pDocument;
|
||||
|
||||
@ -58,14 +58,12 @@
|
||||
#include "Src/RendererOutputDev.h"
|
||||
#include "Src/Adaptors.h"
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
#include "../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
#include "lib/xpdf/Outline.h"
|
||||
#include "lib/xpdf/Link.h"
|
||||
#include "lib/xpdf/TextOutputDev.h"
|
||||
#include "lib/goo/GList.h"
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
namespace PdfReader
|
||||
{
|
||||
@ -613,7 +611,6 @@ return 0;
|
||||
|
||||
return sRes;
|
||||
}
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
void getBookmars(PDFDoc* pdfDoc, OutlineItem* pOutlineItem, NSWasm::CData& out, int level)
|
||||
{
|
||||
int nLengthTitle = pOutlineItem->getTitleLength();
|
||||
@ -787,5 +784,4 @@ return 0;
|
||||
|
||||
return oLinks.Serialize();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -103,10 +103,8 @@ namespace PdfReader
|
||||
PDFDoc* GetPDFDocument();
|
||||
void ChangeLength(DWORD nLength);
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
virtual BYTE* GetStructure();
|
||||
virtual BYTE* GetLinks(int nPageIndex);
|
||||
#endif
|
||||
|
||||
private:
|
||||
CPdfReader_Private* m_pInternal;
|
||||
|
||||
@ -220,7 +220,6 @@ void CXpsFile::ConvertToPdf(const std::wstring& wsPath)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
BYTE* CXpsFile::GetStructure()
|
||||
{
|
||||
return m_pInternal->m_pDocument->GetStructure();
|
||||
@ -229,4 +228,3 @@ BYTE* CXpsFile::GetLinks (int nPageIndex)
|
||||
{
|
||||
return m_pInternal->m_pDocument->GetPageLinks(nPageIndex);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -71,10 +71,8 @@ public:
|
||||
void ConvertToPdf(const std::wstring& wsDstPath);
|
||||
#endif
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
virtual BYTE* GetStructure();
|
||||
virtual BYTE* GetLinks(int nPageIndex);
|
||||
#endif
|
||||
|
||||
private:
|
||||
CXpsFile_Private* m_pInternal;
|
||||
|
||||
@ -192,7 +192,6 @@ namespace XPS
|
||||
|
||||
std::wstring wsFilePath = GetPath(wsSourceFile);
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
// Оглавление, содержание, structure
|
||||
oReader.Clear();
|
||||
|
||||
@ -271,7 +270,6 @@ namespace XPS
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
oReader.Clear();
|
||||
|
||||
@ -305,7 +303,6 @@ namespace XPS
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
if (!oReader.IsEmptyElement())
|
||||
{
|
||||
int nDepth = oReader.GetDepth();
|
||||
@ -333,7 +330,6 @@ namespace XPS
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m_mPages.insert(std::pair<int, XPS::Page*>(nIndex++, new XPS::Page(wsPagePath, m_wsPath, &m_oFontList, m_pFontManager, this)));
|
||||
}
|
||||
@ -352,7 +348,6 @@ namespace XPS
|
||||
if (oIter != m_mPages.end())
|
||||
oIter->second->GetSize(nW, nH);
|
||||
}
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
BYTE* CDocument::GetStructure()
|
||||
{
|
||||
NSWasm::CData oRes;
|
||||
@ -376,7 +371,6 @@ namespace XPS
|
||||
return oIter->second->m_oLinks.Serialize();
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
void CDocument::DrawPage(int nPageIndex, IRenderer* pRenderer, bool* pbBreak)
|
||||
{
|
||||
std::map<int, XPS::Page*>::const_iterator oIter = m_mPages.find(nPageIndex);
|
||||
|
||||
@ -59,7 +59,6 @@ namespace XPS
|
||||
CStaticResource* GetStaticResource(const wchar_t* wsPath);
|
||||
std::wstring GetInfo();
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
struct CDocumentStructure
|
||||
{
|
||||
int nLevel;
|
||||
@ -72,7 +71,6 @@ namespace XPS
|
||||
BYTE* GetPageLinks (int nPageIndex);
|
||||
std::vector<CDocumentStructure> m_vStructure;
|
||||
std::map<std::wstring, int> m_mInternalLinks;
|
||||
#endif
|
||||
private:
|
||||
|
||||
IFolder* m_wsPath;
|
||||
|
||||
@ -837,9 +837,7 @@ namespace XPS
|
||||
CWString wsFill;
|
||||
|
||||
CWString wsClip, wsTransform, wsPathData, wsPathTransform;
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
std::vector<CDocument::CDocumentStructure>::iterator find = m_pDocument->m_vStructure.end();
|
||||
#endif
|
||||
if (oReader.MoveToFirstAttribute())
|
||||
{
|
||||
std::wstring wsAttrName = oReader.GetName();
|
||||
@ -929,7 +927,6 @@ namespace XPS
|
||||
{
|
||||
wsPathData.create(oReader.GetText(), true);
|
||||
}
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
else if (L"Name" == wsAttrName)
|
||||
{
|
||||
std::wstring wsNameTarget = oReader.GetText();
|
||||
@ -1016,7 +1013,6 @@ namespace XPS
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!oReader.MoveToNextAttribute())
|
||||
break;
|
||||
@ -1025,7 +1021,6 @@ namespace XPS
|
||||
}
|
||||
}
|
||||
oReader.MoveToElement();
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
if (find != m_pDocument->m_vStructure.end())
|
||||
{
|
||||
std::wstring wsPath = wsPathData.c_stdstr();
|
||||
@ -1038,7 +1033,6 @@ namespace XPS
|
||||
find->dY = GetDouble(wsPath.substr(nFindY, nFindEndY - nFindY));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CBrush* pBrush = NULL;
|
||||
bool bDeleteBrush = false;
|
||||
|
||||
@ -39,9 +39,7 @@
|
||||
#include "Utils.h"
|
||||
#include "ContextState.h"
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
#include "../../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
#endif
|
||||
|
||||
namespace XPS
|
||||
{
|
||||
@ -57,9 +55,7 @@ namespace XPS
|
||||
void GetSize(int& nW, int& nH) const;
|
||||
void Draw(IRenderer* pRenderer, bool* pbBreak);
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
NSWasm::CPageLink m_oLinks;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user