mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-19 05:57:25 +08:00
Adding parsing of hwpx format elements
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user