fix PdfReader and PdfWriter, fix BUILDING_WASM_MODULE

This commit is contained in:
Kulikova Svetlana
2022-11-03 17:47:16 +03:00
parent e27a20f9ae
commit d70d4d50f0
20 changed files with 868 additions and 960 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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: