Adding parsing of hwpx format elements

This commit is contained in:
Green
2025-01-17 02:42:21 +03:00
parent 43f1ac0596
commit b78e2cb33c
23 changed files with 719 additions and 266 deletions

View File

@ -1,12 +1,12 @@
#include "HWPFile.h"
#include "HwpDoc/HWPFile_Private.h"
#include "HwpDoc/Conversion/WriterContext.h"
#include "../DesktopEditor/common/File.h"
#include "HwpDoc/Conversion/Converter2OOXML.h"
CHWPFile::CHWPFile(const std::wstring& wsFileName)
: m_pInternal(new HWP::CHWPFile_Private(wsFileName))
CHWPFile::CHWPFile()
: m_pInternal(new HWP::CWriterContext())
{}
CHWPFile::~CHWPFile()
@ -20,12 +20,20 @@ void CHWPFile::SetTempDirectory(const std::wstring& wsTempDirectory)
m_wsTempDirectory = wsTempDirectory;
}
bool CHWPFile::Open()
bool CHWPFile::OpenHWP(const std::wstring& wsFilePath)
{
if (nullptr == m_pInternal)
return false;
return m_pInternal->Open();
return m_pInternal->Open(wsFilePath, HWP::EHanType::HWP);
}
bool CHWPFile::OpenHWPX(const std::wstring& wsFilePath)
{
if (nullptr == m_pInternal)
return false;
return m_pInternal->Open(wsFilePath, HWP::EHanType::HWPX);
}
void CHWPFile::Close()
@ -38,7 +46,7 @@ bool CHWPFile::ConvertToOOXML(const std::wstring& wsFilePath)
{
HWP::CConverter2OOXML oConverter;
oConverter.SetHWPFile(m_pInternal);
oConverter.SetContext(m_pInternal);
oConverter.SetTempDirectory(m_wsTempDirectory);
return oConverter.ConvertToFile(wsFilePath);
@ -48,7 +56,17 @@ bool CHWPFile::ConvertToOOXML_Dir(const std::wstring& wsDirectoryPath)
{
HWP::CConverter2OOXML oConverter;
oConverter.SetHWPFile(m_pInternal);
oConverter.SetContext(m_pInternal);
return oConverter.ConvertToDir(wsDirectoryPath);
}
bool CHWPFile::IsHWPFormat(const std::wstring& wsFilePath)
{
return HWP::EHanType::HWP == HWP::CWriterContext::DetectHancom(wsFilePath);
}
bool CHWPFile::IsHWPXFormat(const std::wstring& wsFilePath)
{
return HWP::EHanType::HWPX == HWP::CWriterContext::DetectHancom(wsFilePath);
}