mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
The writing code for converting hwp format
This commit is contained in:
@ -12,7 +12,7 @@ PWD_ROOT_DIR = $$PWD
|
||||
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
ADD_DEPENDENCY(kernel)
|
||||
ADD_DEPENDENCY(kernel, UnicodeConverter)
|
||||
|
||||
SOURCES += \
|
||||
HwpDoc/HWPDocInfo.cpp \
|
||||
|
||||
@ -7,9 +7,10 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
#define CHAR char16_t
|
||||
#define STRING std::string
|
||||
#define BYTE char
|
||||
typedef char16_t CHAR;
|
||||
typedef std::string STRING;
|
||||
typedef char BYTE;
|
||||
|
||||
#define LIST std::list
|
||||
#define VECTOR std::vector
|
||||
|
||||
|
||||
@ -80,5 +80,7 @@ bool CHWPDocInfo::Parse(CHWPStream& oBuffer, int nVersion)
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#ifndef HWPDOCINFO_H
|
||||
#define HWPDOCINFO_H
|
||||
|
||||
#include "HWPFile.h"
|
||||
#include "HanType.h"
|
||||
#include "HWPStream.h"
|
||||
#include "HWPElements/HWPRecord.h"
|
||||
@ -11,6 +10,7 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
class CHWPFile;
|
||||
class CHWPDocInfo
|
||||
{
|
||||
EHanType m_eHanType;
|
||||
|
||||
@ -5,7 +5,6 @@ namespace HWP
|
||||
CHWPRecordBinData::CHWPRecordBinData(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
|
||||
: CHWPRecord(nTagNum, nLevel, nSize)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
STRING CHWPRecordBinData::GetItemID() const
|
||||
@ -13,4 +12,5 @@ STRING CHWPRecordBinData::GetItemID() const
|
||||
return m_sItemID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,13 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
enum class ECompressed
|
||||
{
|
||||
FOLLOW_STORAGE = 0x00,
|
||||
COMPRESS = 0x10,
|
||||
NO_COMPRESS = 0x20
|
||||
};
|
||||
|
||||
class CHWPRecordBinData : public CHWPRecord
|
||||
{
|
||||
enum class EType
|
||||
@ -16,12 +23,7 @@ class CHWPRecordBinData : public CHWPRecord
|
||||
STORAGE = 0x2
|
||||
} m_eType;
|
||||
|
||||
enum class ECompressed
|
||||
{
|
||||
FOLLOW_STORAGE = 0x00,
|
||||
COMPRESS = 0x10,
|
||||
NO_COMPRESS = 0x20
|
||||
} m_eCompressed;
|
||||
ECompressed m_eCompressed;
|
||||
|
||||
enum class EState
|
||||
{
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
|
||||
struct TBorder
|
||||
{
|
||||
ELineStyle2 m_eStyle;
|
||||
|
||||
@ -35,12 +35,12 @@ struct TParameterSet
|
||||
{
|
||||
short m_shParamSetId;
|
||||
short m_shNItems;
|
||||
std::list<TParameterItem> m_arItems;
|
||||
LIST<TParameterItem> m_arItems;
|
||||
};
|
||||
|
||||
class CHWPRecordCtrlData : public CHWPRecord
|
||||
{
|
||||
std::list<TParameterSet> m_arParamSets;
|
||||
LIST<TParameterSet> m_arParamSets;
|
||||
public:
|
||||
CHWPRecordCtrlData(int nTagNum, int nLevel, int nSize);
|
||||
};
|
||||
|
||||
@ -1,5 +1,18 @@
|
||||
#include "HWPRecordCtrlHeader.h"
|
||||
|
||||
#include "../Paragraph/CtrlAutoNumber.h"
|
||||
#include "../Paragraph/CtrlClick.h"
|
||||
#include "../Paragraph/CtrlColumnDef.h"
|
||||
#include "../Paragraph/CtrlEqEdit.h"
|
||||
#include "../Paragraph/CtrlForm.h"
|
||||
#include "../Paragraph/CtrlGeneralShape.h"
|
||||
#include "../Paragraph/CtrlHeadFoot.h"
|
||||
#include "../Paragraph/CtrlNewNumber.h"
|
||||
#include "../Paragraph/CtrlNote.h"
|
||||
#include "../Paragraph/CtrlPageNumPos.h"
|
||||
#include "../Paragraph/CtrlSectionDef.h"
|
||||
#include "../Paragraph/CtrlTable.h"
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
CHWPRecordCtrlHeader::CHWPRecordCtrlHeader(int nTagNum, int nLevel, int nSize)
|
||||
@ -26,7 +39,7 @@ CCtrl* CHWPRecordCtrlHeader::Parse(int nTagNum, int nLevel, int nSize, CHWPStrea
|
||||
else if (" nf" == sCtrlID || " ne" == sCtrlID)
|
||||
pCtrl = new CCtrlNote(sCtrlID, nSize - oBuffer.GetDistanceToLastPos(), oBuffer, 0, nVersion);
|
||||
else if (" lbt" == sCtrlID)
|
||||
pCtrl = new CCtrlTalbe(sCtrlID, nSize - oBuffer.GetDistanceToLastPos(), oBuffer, 0, nVersion);
|
||||
pCtrl = new CCtrlTable(sCtrlID, nSize - oBuffer.GetDistanceToLastPos(), oBuffer, 0, nVersion);
|
||||
else if ("onta" == sCtrlID)
|
||||
pCtrl = new CCtrlAutoNumber(sCtrlID, nSize - oBuffer.GetDistanceToLastPos(), oBuffer, 0, nVersion);
|
||||
else if ("onwn" == sCtrlID)
|
||||
|
||||
@ -3,18 +3,8 @@
|
||||
|
||||
#include "HWPRecord.h"
|
||||
|
||||
#include "../Paragraph/CtrlAutoNumber.h"
|
||||
#include "../Paragraph/CtrlClick.h"
|
||||
#include "../Paragraph/CtrlColumnDef.h"
|
||||
#include "../Paragraph/CtrlEqEdit.h"
|
||||
#include "../Paragraph/CtrlForm.h"
|
||||
#include "../Paragraph/CtrlGeneralShape.h"
|
||||
#include "../Paragraph/CtrlHeadFoot.h"
|
||||
#include "../Paragraph/CtrlNewNumber.h"
|
||||
#include "../Paragraph/CtrlNote.h"
|
||||
#include "../Paragraph/CtrlPageNumPos.h"
|
||||
#include "../Paragraph/CtrlSectionDef.h"
|
||||
#include "../Paragraph/CtrlTable.h"
|
||||
#include "../Paragraph/Ctrl.h"
|
||||
#include "../HWPStream.h"
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
|
||||
enum class EIndex
|
||||
{
|
||||
BIN_DATA,
|
||||
@ -36,7 +35,7 @@ enum class EIndex
|
||||
class CHWPRecordIDMaping : public CHWPRecord
|
||||
{
|
||||
CHWPDocInfo *m_pParent;
|
||||
std::list<int> m_arIdMappingNum;
|
||||
LIST<int> m_arIdMappingNum;
|
||||
|
||||
int m_arCounts[static_cast<int>(EIndex::MAX)];
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ LIST<CCtrl*> CHWPRecordParaText::Parse(int nTagNum, int nLevel, int nSize, CHWPS
|
||||
if (" osg" == sInfo)
|
||||
arParas.push_back(new CCtrlGeneralShape(sInfo));
|
||||
else if (" lbt" == sInfo)
|
||||
arParas.push_back(new CCtrlTalbe(sInfo));
|
||||
arParas.push_back(new CCtrlTable(sInfo));
|
||||
else if ("deqe" == sInfo)
|
||||
arParas.push_back(new CCtrlEqEdit(sInfo));
|
||||
// else if ("mrof" == sInfo)
|
||||
|
||||
@ -4,65 +4,65 @@
|
||||
namespace HWP
|
||||
{
|
||||
|
||||
#define ADD_HWP_TAG(name, index) name = 0x010 + index
|
||||
#define ADD_TAG(name, index) name = 0x010 + index
|
||||
|
||||
enum EHWPTag
|
||||
{
|
||||
ADD_HWP_TAG(null, -1),
|
||||
ADD_TAG(null, -1),
|
||||
|
||||
ADD_HWP_TAG(HWPTAG_DOCUMENT_PROPERTIES, 0),
|
||||
ADD_HWP_TAG(HWPTAG_ID_MAPPINGS, 1),
|
||||
ADD_HWP_TAG(HWPTAG_BIN_DATA, 2),
|
||||
ADD_HWP_TAG(HWPTAG_FACE_NAME, 3),
|
||||
ADD_HWP_TAG(HWPTAG_BORDER_FILL, 4),
|
||||
ADD_HWP_TAG(HWPTAG_CHAR_SHAPE, 5),
|
||||
ADD_HWP_TAG(HWPTAG_TAB_DEF, 6),
|
||||
ADD_HWP_TAG(HWPTAG_NUMBERING, 7),
|
||||
ADD_HWP_TAG(HWPTAG_BULLET, 8),
|
||||
ADD_HWP_TAG(HWPTAG_PARA_SHAPE, 9),
|
||||
ADD_HWP_TAG(HWPTAG_STYLE, 10),
|
||||
ADD_HWP_TAG(HWPTAG_DOC_DATA, 11),
|
||||
ADD_HWP_TAG(HWPTAG_DISTRIBUTE_DOC_DATA, 12),
|
||||
ADD_HWP_TAG(HWPTAG_COMPATIBLE_DOCUMENT, 13),
|
||||
ADD_HWP_TAG(HWPTAG_LAYOUT_COMPATIBILITY, 14),
|
||||
ADD_HWP_TAG(HWPTAG_TRACKCHANGE, 15),
|
||||
ADD_TAG(HWPTAG_DOCUMENT_PROPERTIES, 0),
|
||||
ADD_TAG(HWPTAG_ID_MAPPINGS, 1),
|
||||
ADD_TAG(HWPTAG_BIN_DATA, 2),
|
||||
ADD_TAG(HWPTAG_FACE_NAME, 3),
|
||||
ADD_TAG(HWPTAG_BORDER_FILL, 4),
|
||||
ADD_TAG(HWPTAG_CHAR_SHAPE, 5),
|
||||
ADD_TAG(HWPTAG_TAB_DEF, 6),
|
||||
ADD_TAG(HWPTAG_NUMBERING, 7),
|
||||
ADD_TAG(HWPTAG_BULLET, 8),
|
||||
ADD_TAG(HWPTAG_PARA_SHAPE, 9),
|
||||
ADD_TAG(HWPTAG_STYLE, 10),
|
||||
ADD_TAG(HWPTAG_DOC_DATA, 11),
|
||||
ADD_TAG(HWPTAG_DISTRIBUTE_DOC_DATA, 12),
|
||||
ADD_TAG(HWPTAG_COMPATIBLE_DOCUMENT, 13),
|
||||
ADD_TAG(HWPTAG_LAYOUT_COMPATIBILITY, 14),
|
||||
ADD_TAG(HWPTAG_TRACKCHANGE, 15),
|
||||
|
||||
ADD_HWP_TAG(HWPTAG_PARA_HEADER, 50),
|
||||
ADD_HWP_TAG(HWPTAG_PARA_TEXT, 51),
|
||||
ADD_HWP_TAG(HWPTAG_PARA_CHAR_SHAPE, 52),
|
||||
ADD_HWP_TAG(HWPTAG_PARA_LINE_SEG, 53),
|
||||
ADD_HWP_TAG(HWPTAG_PARA_RANGE_TAG, 54),
|
||||
ADD_HWP_TAG(HWPTAG_CTRL_HEADER, 55),
|
||||
ADD_HWP_TAG(HWPTAG_LIST_HEADER, 56),
|
||||
ADD_HWP_TAG(HWPTAG_PAGE_DEF, 57),
|
||||
ADD_HWP_TAG(HWPTAG_FOOTNOTE_SHAPE, 58),
|
||||
ADD_HWP_TAG(HWPTAG_PAGE_BORDER_FILL, 59),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT, 60),
|
||||
ADD_HWP_TAG(HWPTAG_TABLE, 61),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_LINE, 62),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_RECTANGLE, 63),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_ELLIPSE, 64),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_ARC, 65),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_POLYGON, 66),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_CURVE, 67),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_OLE, 68),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_PICTURE, 69),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_CONTAINER, 70),
|
||||
ADD_HWP_TAG(HWPTAG_CTRL_DATA, 71),
|
||||
ADD_HWP_TAG(HWPTAG_EQEDIT, 72),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_TEXTART, 74),
|
||||
ADD_HWP_TAG(HWPTAG_FORM_OBJECT, 75),
|
||||
ADD_HWP_TAG(HWPTAG_MEMO_SHAPE, 76),
|
||||
ADD_HWP_TAG(HWPTAG_MEMO_LIST, 77),
|
||||
ADD_HWP_TAG(HWPTAG_FORBIDDEN_CHAR, 78),
|
||||
ADD_HWP_TAG(HWPTAG_CHART_DATA, 79),
|
||||
ADD_HWP_TAG(HWPTAG_TRACK_CHANGE, 80),
|
||||
ADD_HWP_TAG(HWPTAG_TRACK_CHANGE_AUTHOR, 81),
|
||||
ADD_HWP_TAG(HWPTAG_VIDEO_DATA, 82),
|
||||
ADD_HWP_TAG(HWPTAG_SHAPE_COMPONENT_UNKNOWN, 99)
|
||||
ADD_TAG(HWPTAG_PARA_HEADER, 50),
|
||||
ADD_TAG(HWPTAG_PARA_TEXT, 51),
|
||||
ADD_TAG(HWPTAG_PARA_CHAR_SHAPE, 52),
|
||||
ADD_TAG(HWPTAG_PARA_LINE_SEG, 53),
|
||||
ADD_TAG(HWPTAG_PARA_RANGE_TAG, 54),
|
||||
ADD_TAG(HWPTAG_CTRL_HEADER, 55),
|
||||
ADD_TAG(HWPTAG_LIST_HEADER, 56),
|
||||
ADD_TAG(HWPTAG_PAGE_DEF, 57),
|
||||
ADD_TAG(HWPTAG_FOOTNOTE_SHAPE, 58),
|
||||
ADD_TAG(HWPTAG_PAGE_BORDER_FILL, 59),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT, 60),
|
||||
ADD_TAG(HWPTAG_TABLE, 61),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_LINE, 62),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_RECTANGLE, 63),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_ELLIPSE, 64),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_ARC, 65),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_POLYGON, 66),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_CURVE, 67),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_OLE, 68),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_PICTURE, 69),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_CONTAINER, 70),
|
||||
ADD_TAG(HWPTAG_CTRL_DATA, 71),
|
||||
ADD_TAG(HWPTAG_EQEDIT, 72),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_TEXTART, 74),
|
||||
ADD_TAG(HWPTAG_FORM_OBJECT, 75),
|
||||
ADD_TAG(HWPTAG_MEMO_SHAPE, 76),
|
||||
ADD_TAG(HWPTAG_MEMO_LIST, 77),
|
||||
ADD_TAG(HWPTAG_FORBIDDEN_CHAR, 78),
|
||||
ADD_TAG(HWPTAG_CHART_DATA, 79),
|
||||
ADD_TAG(HWPTAG_TRACK_CHANGE, 80),
|
||||
ADD_TAG(HWPTAG_TRACK_CHANGE_AUTHOR, 81),
|
||||
ADD_TAG(HWPTAG_VIDEO_DATA, 82),
|
||||
ADD_TAG(HWPTAG_SHAPE_COMPONENT_UNKNOWN, 99)
|
||||
};
|
||||
|
||||
EHWPTag GetTagFromNum(int nTagNum)
|
||||
inline EHWPTag GetTagFromNum(int nTagNum)
|
||||
{
|
||||
switch (static_cast<EHWPTag>(nTagNum))
|
||||
{
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
|
||||
enum class ELineStyle1
|
||||
{
|
||||
SOLID,
|
||||
@ -25,7 +24,7 @@ enum class ELineStyle1
|
||||
SOLID_3D_REVERS_LI
|
||||
};
|
||||
|
||||
ELineStyle1 GetLineStyle1(int nValue)
|
||||
inline ELineStyle1 GetLineStyle1(int nValue)
|
||||
{
|
||||
switch(static_cast<ELineStyle1>(nValue))
|
||||
{
|
||||
@ -68,7 +67,7 @@ enum class ELineStyle2
|
||||
SLIM_THICK_SLIM
|
||||
};
|
||||
|
||||
ELineStyle2 GetLineStyle2(int nValue)
|
||||
inline ELineStyle2 GetLineStyle2(int nValue)
|
||||
{
|
||||
switch(static_cast<ELineStyle2>(nValue))
|
||||
{
|
||||
@ -108,7 +107,7 @@ enum class ENumberShape1
|
||||
CIRCLED_IDEOGRAPH
|
||||
};
|
||||
|
||||
ENumberShape1 GetNumberShape1(int nValue)
|
||||
inline ENumberShape1 GetNumberShape1(int nValue)
|
||||
{
|
||||
switch (static_cast<ENumberShape1>(nValue))
|
||||
{
|
||||
@ -156,7 +155,7 @@ enum class ENumberShape2
|
||||
USER_CHAR = 0x81
|
||||
};
|
||||
|
||||
ENumberShape2 GetNumberShape2(int nValue)
|
||||
inline ENumberShape2 GetNumberShape2(int nValue)
|
||||
{
|
||||
switch (static_cast<ENumberShape2>(nValue))
|
||||
{
|
||||
@ -199,7 +198,7 @@ enum class ELineArrowStyle
|
||||
EMPTY_BOX
|
||||
};
|
||||
|
||||
ELineArrowStyle GetLineArrowStyle(int nNum, bool bFill)
|
||||
inline ELineArrowStyle GetLineArrowStyle(int nNum, bool bFill)
|
||||
{
|
||||
switch (nNum)
|
||||
{
|
||||
@ -230,7 +229,7 @@ enum class ELineArrowSize
|
||||
LARGE_LARGE
|
||||
};
|
||||
|
||||
ELineArrowSize GetLineArrowSize(int nValue)
|
||||
inline ELineArrowSize GetLineArrowSize(int nValue)
|
||||
{
|
||||
switch(static_cast<ELineArrowSize>(nValue))
|
||||
{
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
#include "HWPFile.h"
|
||||
#include "HWPDocInfo.h"
|
||||
|
||||
#include "../DesktopEditor/common/Directory.h"
|
||||
#include <regex>
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
CHWPFile::CHWPFile(const STRING& sFileName)
|
||||
@ -15,24 +18,285 @@ CHWPFile::~CHWPFile()
|
||||
|
||||
std::vector<CHWPSection*> CHWPFile::GetSections()
|
||||
{
|
||||
if (m_oFileHeader.GetDistributable())
|
||||
if (m_oFileHeader.Distributable())
|
||||
return m_arViewTexts;
|
||||
else
|
||||
return m_arBodyTexts;
|
||||
}
|
||||
|
||||
CCompoundFile* CHWPFile::GetOleFile()
|
||||
const CCompoundFile* CHWPFile::GetOleFile() const
|
||||
{
|
||||
return &m_oOleFile;
|
||||
}
|
||||
|
||||
bool CHWPFile::Detect()
|
||||
{
|
||||
// read CompoundFile structure
|
||||
if (!m_oOleFile.Open() || !GetFileHeader())
|
||||
{
|
||||
m_oOleFile.Close();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CHWPFile::Open()
|
||||
{
|
||||
if (m_oFileHeader.SignatureEmpty() || m_oFileHeader.VersionEmpty())
|
||||
Detect();
|
||||
|
||||
//TODO:: добавить отдельный метод StringToInt
|
||||
m_nVersion = std::stoi(m_oFileHeader.GetVersion());
|
||||
|
||||
//TODO:: проверить данный момент
|
||||
if (m_oFileHeader.PasswordEncrypted())
|
||||
return false;
|
||||
|
||||
if (!GetDocInfo(m_nVersion))
|
||||
return false;
|
||||
|
||||
if (!m_oFileHeader.Distributable() && !GetBodyText(m_nVersion))
|
||||
return false;
|
||||
|
||||
if (!m_oFileHeader.Distributable() && !GetViewText(m_nVersion))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CHWPFile::Close()
|
||||
{
|
||||
m_oOleFile.Close();
|
||||
}
|
||||
|
||||
void CHWPFile::SaveHWPComponent()
|
||||
{
|
||||
ECompressed eCompressed = m_oFileHeader.Compressed() ? ECompressed::COMPRESS : ECompressed::NO_COMPRESS;
|
||||
|
||||
// Save internal component for debugging purpose.
|
||||
// TODO:: перенести
|
||||
}
|
||||
|
||||
bool CHWPFile::GetFileHeader()
|
||||
{
|
||||
CHWPStream oBuffer;
|
||||
if (!GetComponent("FileHeader", oBuffer))
|
||||
return false;
|
||||
|
||||
return m_oFileHeader.Parse(oBuffer);
|
||||
}
|
||||
|
||||
const CHWPDocInfo* CHWPFile::GetDocInfo() const
|
||||
{
|
||||
return &m_oDocInfo;
|
||||
}
|
||||
|
||||
bool CHWPFile::GetDocInfo(int nVersion)
|
||||
{
|
||||
CHWPStream oBuffer;
|
||||
if (m_oFileHeader.Compressed())
|
||||
{
|
||||
CHWPStream oTempBuffer;
|
||||
|
||||
if (!GetComponent("DocInfo", oTempBuffer) && !Unzip(oTempBuffer, oBuffer))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetComponent("DocInfo", oBuffer))
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_oDocInfo.Parse(oBuffer, m_nVersion);
|
||||
}
|
||||
|
||||
bool CHWPFile::GetComponent(const std::string& sEntryName, CHWPStream& oBuffer)
|
||||
{
|
||||
return m_oOleFile.GetComponent(sEntryName, oBuffer);
|
||||
}
|
||||
|
||||
//TODO:: написанно, что данные методы используются только для отображения в LibbreOffice
|
||||
// проверить и если нужны будут, то реализовать
|
||||
VECTOR<CDirectoryEntry*> CHWPFile::GetBinData()
|
||||
{
|
||||
return VECTOR<CDirectoryEntry*>();
|
||||
}
|
||||
|
||||
void CHWPFile::SetBinData(const std::vector<CDirectoryEntry*>& arBinData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VECTOR<CHWPPargraph*> CHWPFile::GetParas()
|
||||
{
|
||||
return VECTOR<CHWPPargraph*>();
|
||||
}
|
||||
|
||||
void CHWPFile::AddParas(const std::vector<CHWPPargraph*>& arParas)
|
||||
{
|
||||
|
||||
}
|
||||
//------------
|
||||
|
||||
void CHWPFile::SaveChildEntries(const std::string& sBasePath, const std::string& sStorageName, ECompressed eCompressed)
|
||||
{
|
||||
// TODO:: перенести
|
||||
}
|
||||
|
||||
CDirectoryEntry* CHWPFile::FindChildEntry(const std::string& sBasePath, const CDirectoryEntry& oBaseEntry, const std::string& sEntryName)
|
||||
{
|
||||
for (CDirectoryEntry* pEntry : m_oOleFile.GetChildEntries(&oBaseEntry))
|
||||
{
|
||||
if (0x01 == pEntry->GetObjectType())
|
||||
{
|
||||
//TODO:: проверить
|
||||
STRING sChildPath = sBasePath + FILE_SEPARATOR_CHAR + pEntry->GetDirectoryEntryName();
|
||||
return FindChildEntry(sChildPath, *pEntry, sEntryName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sEntryName == pEntry->GetDirectoryEntryName())
|
||||
return pEntry;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
STRING CHWPFile::SaveChildEntry(const std::string& sRootPath, const std::string& sEntryName, ECompressed eCompressed)
|
||||
{
|
||||
//TODO:: перенести
|
||||
return STRING();
|
||||
}
|
||||
|
||||
bool CHWPFile::GetChildStream(const std::string& sEntryName, ECompressed eCompressed, CHWPStream& oBuffer)
|
||||
{
|
||||
STRING sRegexStr = ".*" + STRING(FILE_SEPARATOR_STRA) + "([" + STRING(FILE_SEPARATOR_STRA) + "]+)$";
|
||||
|
||||
STRING sShortFilename = std::regex_replace(m_sFileName, std::regex(sRegexStr), "$1");
|
||||
sShortFilename = std::regex_replace(sShortFilename, std::regex("(.*)\\.hwp$"), "$1");
|
||||
|
||||
CDirectoryEntry *pTargetEntry = nullptr;
|
||||
|
||||
VECTOR<CDirectoryEntry*> arEntries = m_oOleFile.GetChildEntries("Root Entry");
|
||||
|
||||
for (CDirectoryEntry* pEntry : arEntries)
|
||||
{
|
||||
if (0x01 == pEntry->GetObjectType())
|
||||
{
|
||||
STRING sChildPath = sShortFilename + FILE_SEPARATOR_CHAR + pEntry->GetDirectoryEntryName();
|
||||
pTargetEntry = FindChildEntry(sChildPath, *pEntry, sEntryName);
|
||||
|
||||
if (nullptr != pTargetEntry)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sEntryName == pEntry->GetDirectoryEntryName())
|
||||
{
|
||||
pTargetEntry = pEntry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nullptr == pTargetEntry)
|
||||
return false;
|
||||
|
||||
if (ECompressed::COMPRESS == eCompressed || (ECompressed::FOLLOW_STORAGE == eCompressed && m_oFileHeader.Compressed()))
|
||||
{
|
||||
CHWPStream oTempBuffer;
|
||||
if (!m_oOleFile.Read(*pTargetEntry, oTempBuffer))
|
||||
return false;
|
||||
|
||||
return Unzip(oTempBuffer, oBuffer);
|
||||
}
|
||||
else
|
||||
return m_oOleFile.Read(*pTargetEntry, oBuffer);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CHWPFile::Unzip(CHWPStream& oInput, CHWPStream& oBuffer)
|
||||
{
|
||||
//TODO:: реализовать
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CHWPFile::Decrypt(CHWPStream& oInput, CHWPStream& oBuffer)
|
||||
{
|
||||
int nHeader;
|
||||
oInput.ReadInt(nHeader);
|
||||
|
||||
int nTagNum = nHeader & 0x3FF; // 10 bits (0 - 9 bit)
|
||||
int nLevel = (nHeader & 0xFFC00) >> 10; // 10 bits (10-19 bit)
|
||||
int nSize = (nHeader & 0xFFF00000) >> 20; // 12 bits (20-31 bit)
|
||||
|
||||
EHWPTag eTag = GetTagFromNum(nTagNum);
|
||||
|
||||
if (EHWPTag::HWPTAG_DISTRIBUTE_DOC_DATA != eTag)
|
||||
return false;
|
||||
|
||||
if (256 != nSize)
|
||||
return false;
|
||||
|
||||
//TODO:: реализовать
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CHWPFile::GetBodyText(int nVersion)
|
||||
{
|
||||
VECTOR<CDirectoryEntry*> arSections{m_oOleFile.GetChildEntries("BodyText")};
|
||||
|
||||
for (const CDirectoryEntry* pSection : arSections)
|
||||
{
|
||||
CHWPSection *pHwpSection = new CHWPSection();
|
||||
CHWPStream oBuffer;
|
||||
|
||||
if (m_oFileHeader.Compressed())
|
||||
{
|
||||
CHWPStream oTempBuffer;
|
||||
if (!m_oOleFile.Read(*pSection, oTempBuffer) && !Unzip(oTempBuffer, oBuffer))
|
||||
return false;
|
||||
}
|
||||
else if (!m_oOleFile.Read(*pSection, oBuffer))
|
||||
return false;
|
||||
|
||||
pHwpSection->Parse(oBuffer, m_nVersion);
|
||||
m_arBodyTexts.push_back(pHwpSection);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CHWPFile::GetViewText(int nVersion)
|
||||
{
|
||||
VECTOR<CDirectoryEntry*> arSections{m_oOleFile.GetChildEntries("ViewText")};
|
||||
|
||||
for (const CDirectoryEntry* pSection : arSections)
|
||||
{
|
||||
CHWPSection *pHwpSection = new CHWPSection();
|
||||
CHWPStream oBuffer;
|
||||
|
||||
if (m_oFileHeader.Compressed())
|
||||
{
|
||||
CHWPStream oTempDecryptBuffer, oTempBuffer;
|
||||
if (!m_oOleFile.Read(*pSection, oTempDecryptBuffer) && !!Decrypt(oTempDecryptBuffer, oTempBuffer) && !Unzip(oTempBuffer, oBuffer))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHWPStream oTempBuffer;
|
||||
|
||||
if (!m_oOleFile.Read(*pSection, oTempBuffer) && !Decrypt(oTempBuffer, oBuffer))
|
||||
return false;
|
||||
}
|
||||
|
||||
pHwpSection->Parse(oBuffer, m_nVersion);
|
||||
m_arViewTexts.push_back(pHwpSection);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,13 +3,12 @@
|
||||
|
||||
#include "HwpFileHeader.h"
|
||||
#include "OLEdoc/CompoundFile.h"
|
||||
#include "HWPElements/HWPRecordBinData.h"
|
||||
#include "HWPSection.h"
|
||||
#include <list>
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
class CHWPDocInfo;
|
||||
|
||||
class CHWPFile
|
||||
{
|
||||
STRING m_sFileName;
|
||||
@ -24,10 +23,33 @@ public:
|
||||
~CHWPFile();
|
||||
|
||||
VECTOR<CHWPSection*> GetSections();
|
||||
CCompoundFile* GetOleFile();
|
||||
const CCompoundFile* GetOleFile() const;
|
||||
|
||||
bool Detect();
|
||||
bool Open();
|
||||
void Close();
|
||||
|
||||
void SaveHWPComponent();
|
||||
|
||||
bool GetFileHeader();
|
||||
const CHWPDocInfo* GetDocInfo() const;
|
||||
bool GetDocInfo(int nVersion);
|
||||
bool GetComponent(const STRING& sEntryName, CHWPStream& oBuffer);
|
||||
VECTOR<CDirectoryEntry*> GetBinData();
|
||||
void SetBinData(const VECTOR<CDirectoryEntry*>& arBinData);
|
||||
VECTOR<CHWPPargraph*> GetParas();
|
||||
void AddParas(const VECTOR<CHWPPargraph*>& arParas);
|
||||
private:
|
||||
void SaveChildEntries(const STRING& sBasePath, const STRING& sStorageName, ECompressed eCompressed);
|
||||
CDirectoryEntry* FindChildEntry(const STRING& sBasePath, const CDirectoryEntry& oBaseEntry, const STRING& sEntryName);
|
||||
STRING SaveChildEntry(const STRING& sRootPath, const STRING& sEntryName, ECompressed eCompressed);
|
||||
bool GetChildStream(const STRING& sEntryName, ECompressed eCompressed, CHWPStream& oBuffer);
|
||||
|
||||
bool Unzip(CHWPStream& oInput, CHWPStream& oBuffer);
|
||||
bool Decrypt(CHWPStream& oInput, CHWPStream& oBuffer);
|
||||
|
||||
bool GetBodyText(int nVersion);
|
||||
bool GetViewText(int nVersion);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include "HWPElements/HWPTag.h"
|
||||
|
||||
#include "HwpDoc/Paragraph/CtrlEqEdit.h"
|
||||
#include "Paragraph/CtrlTable.h"
|
||||
#include "Paragraph/CtrlSectionDef.h"
|
||||
#include "Paragraph/CtrlCommon.h"
|
||||
@ -74,6 +75,8 @@ bool CHWPSection::Parse(CHWPStream& oBuffer, int nVersion)
|
||||
m_arParas.push_back(pCurrPara);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CHWPSection::ParseRecurse(CHWPPargraph& oCurrPara, int nRunLevel, CHWPStream& oBuffer, int nOff, int nVersion)
|
||||
|
||||
@ -22,6 +22,8 @@ CHWPStream::~CHWPStream()
|
||||
{
|
||||
if (nullptr != m_pBegin && !m_bExternalBuffer)
|
||||
delete[] m_pBegin;
|
||||
|
||||
m_pBegin = nullptr;
|
||||
}
|
||||
|
||||
void CHWPStream::SetStream(BYTE* pBuffer, unsigned int unSize, bool bExternalBuffer)
|
||||
|
||||
@ -2,66 +2,91 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
CHwpFileHeader::CHwpFileHeader()
|
||||
{}
|
||||
CHwpFileHeader::CHwpFileHeader()
|
||||
{}
|
||||
|
||||
bool CHwpFileHeader::Parse(CHWPStream& oBuffer)
|
||||
{
|
||||
unsigned int unOffset = 0;
|
||||
bool CHwpFileHeader::Parse(CHWPStream& oBuffer)
|
||||
{
|
||||
unsigned int unOffset = 0;
|
||||
|
||||
m_sSignature = STRING((char*)oBuffer.GetCurPtr(), 32);
|
||||
m_sSignature = STRING((char*)oBuffer.GetCurPtr(), 32);
|
||||
|
||||
if ("HWP Document File" != m_sSignature)
|
||||
return false;
|
||||
if ("HWP Document File" != m_sSignature)
|
||||
return false;
|
||||
|
||||
unOffset += 32;
|
||||
unOffset += 32;
|
||||
|
||||
//version
|
||||
unOffset += 4;
|
||||
//version
|
||||
unOffset += 4;
|
||||
|
||||
m_bCompressed = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bPasswordEncrypted = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bDistributable = CHECK_FLAG(oBuffer[unOffset], 0x04);
|
||||
m_bSaveScript = CHECK_FLAG(oBuffer[unOffset], 0x08);
|
||||
m_bDRMprotected = CHECK_FLAG(oBuffer[unOffset], 0x10);
|
||||
m_bHasXMLTemplateStorage =CHECK_FLAG(oBuffer[unOffset], 0x20);
|
||||
m_bHasDocumentHistory = CHECK_FLAG(oBuffer[unOffset], 0x40);
|
||||
m_bHasPkiSignature = CHECK_FLAG(oBuffer[unOffset], 0x80);
|
||||
m_bCompressed = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bPasswordEncrypted = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bDistributable = CHECK_FLAG(oBuffer[unOffset], 0x04);
|
||||
m_bSaveScript = CHECK_FLAG(oBuffer[unOffset], 0x08);
|
||||
m_bDRMprotected = CHECK_FLAG(oBuffer[unOffset], 0x10);
|
||||
m_bHasXMLTemplateStorage =CHECK_FLAG(oBuffer[unOffset], 0x20);
|
||||
m_bHasDocumentHistory = CHECK_FLAG(oBuffer[unOffset], 0x40);
|
||||
m_bHasPkiSignature = CHECK_FLAG(oBuffer[unOffset], 0x80);
|
||||
|
||||
++unOffset;
|
||||
++unOffset;
|
||||
|
||||
m_bPkiEncrypted = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bReservePkiSignature = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bPkiCertificateDRM = CHECK_FLAG(oBuffer[unOffset], 0x04);
|
||||
m_bCCLDocument = CHECK_FLAG(oBuffer[unOffset], 0x08);
|
||||
m_bMobileOptimized = CHECK_FLAG(oBuffer[unOffset], 0x10);
|
||||
m_bPrivateInformation = CHECK_FLAG(oBuffer[unOffset], 0x20);
|
||||
m_bModifyTracking = CHECK_FLAG(oBuffer[unOffset], 0x40);
|
||||
m_bCopyrightKOGL = CHECK_FLAG(oBuffer[unOffset], 0x80);
|
||||
m_bPkiEncrypted = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bReservePkiSignature = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bPkiCertificateDRM = CHECK_FLAG(oBuffer[unOffset], 0x04);
|
||||
m_bCCLDocument = CHECK_FLAG(oBuffer[unOffset], 0x08);
|
||||
m_bMobileOptimized = CHECK_FLAG(oBuffer[unOffset], 0x10);
|
||||
m_bPrivateInformation = CHECK_FLAG(oBuffer[unOffset], 0x20);
|
||||
m_bModifyTracking = CHECK_FLAG(oBuffer[unOffset], 0x40);
|
||||
m_bCopyrightKOGL = CHECK_FLAG(oBuffer[unOffset], 0x80);
|
||||
|
||||
++unOffset;
|
||||
++unOffset;
|
||||
|
||||
m_bHasVideoControl = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bHasMarkFieldControl = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bHasVideoControl = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bHasMarkFieldControl = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
|
||||
unOffset += 2;
|
||||
unOffset += 2;
|
||||
|
||||
m_bCopyrighted = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bCopyProhibited = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bCopyPermitted = CHECK_FLAG(oBuffer[unOffset], 0x04);
|
||||
m_bCopyrighted = CHECK_FLAG(oBuffer[unOffset], 0x01);
|
||||
m_bCopyProhibited = CHECK_FLAG(oBuffer[unOffset], 0x02);
|
||||
m_bCopyPermitted = CHECK_FLAG(oBuffer[unOffset], 0x04);
|
||||
|
||||
unOffset += 4;
|
||||
unOffset += 4;
|
||||
|
||||
//encryptVersion
|
||||
unOffset += 4;
|
||||
//encryptVersion
|
||||
unOffset += 4;
|
||||
|
||||
m_nCountryKOGLLicensed = (int)oBuffer[unOffset];
|
||||
m_nCountryKOGLLicensed = (int)oBuffer[unOffset];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CHwpFileHeader::GetDistributable() const
|
||||
{
|
||||
return m_bDistributable;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CHwpFileHeader::Compressed() const
|
||||
{
|
||||
return m_bCompressed;
|
||||
}
|
||||
|
||||
bool CHwpFileHeader::PasswordEncrypted() const
|
||||
{
|
||||
return m_bPasswordEncrypted;
|
||||
}
|
||||
|
||||
bool CHwpFileHeader::Distributable() const
|
||||
{
|
||||
return m_bDistributable;
|
||||
}
|
||||
|
||||
bool CHwpFileHeader::SignatureEmpty() const
|
||||
{
|
||||
return m_sSignature.empty();
|
||||
}
|
||||
|
||||
bool CHwpFileHeader::VersionEmpty() const
|
||||
{
|
||||
return m_sVersion.empty();
|
||||
}
|
||||
|
||||
STRING CHwpFileHeader::GetVersion() const
|
||||
{
|
||||
return m_sVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,13 @@ class CHwpFileHeader
|
||||
public:
|
||||
CHwpFileHeader();
|
||||
|
||||
bool GetDistributable() const;
|
||||
bool Compressed() const;
|
||||
bool PasswordEncrypted() const;
|
||||
bool Distributable() const;
|
||||
bool SignatureEmpty() const;
|
||||
bool VersionEmpty() const;
|
||||
|
||||
STRING GetVersion() const;
|
||||
|
||||
bool Parse(CHWPStream& oBuffer);
|
||||
};
|
||||
|
||||
@ -288,6 +288,12 @@ bool CCompoundFile::Open()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCompoundFile::Close()
|
||||
{
|
||||
if (m_fFile.is_open())
|
||||
m_fFile.close();
|
||||
}
|
||||
|
||||
void CCompoundFile::AddSiblings(VECTOR<int>& arIndexs, int nCurrentIndex)
|
||||
{
|
||||
if (-1 == nCurrentIndex)
|
||||
|
||||
@ -43,6 +43,7 @@ public:
|
||||
|
||||
bool Read(const CDirectoryEntry& oEntry, CHWPStream& oBuffer);
|
||||
bool Open();
|
||||
void Close();
|
||||
private:
|
||||
void AddSiblings(VECTOR<int>& arIndexs, int nCurrentIndex);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
CCharShape();
|
||||
CCharShape(int nStart, int nID);
|
||||
|
||||
static std::list<CCharShape*> Parse(int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
static LIST<CCharShape*> Parse(int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
static int FillCharShape(int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion, const VECTOR<CCtrl*>& arParas);
|
||||
};
|
||||
}
|
||||
|
||||
@ -18,12 +18,12 @@ struct TCommonObj
|
||||
int m_nObjWidth;
|
||||
int m_nObjHeight;
|
||||
int m_nZOrder;
|
||||
std::vector<short> m_arObjSpaces;
|
||||
VECTOR<short> m_arObjSpaces;
|
||||
int m_nObjInstanceID;
|
||||
int m_nBlockPageBreak;
|
||||
STRING m_sObjDesc;
|
||||
|
||||
std::list<CHWPPargraph*> m_arParas;
|
||||
LIST<CHWPPargraph*> m_arParas;
|
||||
int m_nCaptionAttr;
|
||||
int m_nCaptionWidth;
|
||||
int m_nCaptionSpacing;
|
||||
|
||||
@ -21,7 +21,7 @@ enum class ENumType
|
||||
null
|
||||
};
|
||||
|
||||
ENumType GetNumType(int nValue)
|
||||
inline ENumType GetNumType(int nValue)
|
||||
{
|
||||
switch(static_cast<ENumType>(nValue))
|
||||
{
|
||||
|
||||
@ -16,8 +16,8 @@ class CCtrlColumnDef : public CCtrl
|
||||
short m_shColCount;
|
||||
bool m_bSameSz;
|
||||
short m_shSameGap;
|
||||
std::vector<short> m_arColSzWidths;
|
||||
std::vector<short> m_arColSzGaps;
|
||||
VECTOR<short> m_arColSzWidths;
|
||||
VECTOR<short> m_arColSzGaps;
|
||||
ELineStyle2 m_eColLineStyle;
|
||||
BYTE m_chColLineWidth;
|
||||
int m_nColLineColor;
|
||||
|
||||
@ -132,7 +132,7 @@ namespace HWP
|
||||
m_nSize = oBuffer.GetCurPtr() - pOldCurentPos;
|
||||
}
|
||||
|
||||
void CCtrlCommon::SetTextVerAlign(EVertAlign& eVertAlign)
|
||||
void CCtrlCommon::SetTextVerAlign(EVertAlign eVertAlign)
|
||||
{
|
||||
m_eTextVerAlign = eVertAlign;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ enum class EVertAlign
|
||||
OUTSIDE
|
||||
};
|
||||
|
||||
EVertAlign GetVertAlign(int nValue)
|
||||
inline EVertAlign GetVertAlign(int nValue)
|
||||
{
|
||||
switch(static_cast<EVertAlign>(nValue))
|
||||
{
|
||||
@ -86,6 +86,11 @@ enum class ETextWrap
|
||||
IN_FRONT_OF_TEXT
|
||||
};
|
||||
|
||||
enum class ECtrlCommonType
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
class CCtrlCommon : public CCtrl
|
||||
{
|
||||
int m_nSize;
|
||||
@ -127,7 +132,7 @@ class CCtrlCommon : public CCtrl
|
||||
friend class CCtrlGeneralShape;
|
||||
friend class CCtrlShapeVideo;
|
||||
friend class CCtrlEqEdit;
|
||||
friend class CCtrlTalbe;
|
||||
friend class CCtrlTable;
|
||||
public:
|
||||
CCtrlCommon();
|
||||
CCtrlCommon(const STRING& sCtrlID);
|
||||
|
||||
@ -11,6 +11,7 @@ class CCtrlContainer : public CCtrlGeneralShape
|
||||
VECTOR<STRING> m_arCtrlIdList;
|
||||
VECTOR<CCtrlGeneralShape*> m_arList;
|
||||
public:
|
||||
CCtrlContainer(const STRING& sCtrlID);
|
||||
CCtrlContainer(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
~CCtrlContainer();
|
||||
|
||||
@ -19,6 +20,9 @@ public:
|
||||
template <typename FindClass>
|
||||
FindClass* FindLastElement();
|
||||
|
||||
void AddShape(CCtrlGeneralShape* pShape);
|
||||
CCtrlGeneralShape* GetLastShape();
|
||||
|
||||
static int ParseElement(CCtrlContainer& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
static int ParseCtrl(CCtrlContainer& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
};
|
||||
|
||||
@ -15,6 +15,7 @@ class CCtrlEqEdit : public CCtrlGeneralShape
|
||||
STRING m_sVersion;
|
||||
STRING m_sFont;
|
||||
public:
|
||||
CCtrlEqEdit();
|
||||
CCtrlEqEdit(const STRING& sCtrlID);
|
||||
CCtrlEqEdit(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeArc::CCtrlShapeArc()
|
||||
{}
|
||||
|
||||
CCtrlShapeArc::CCtrlShapeArc(const std::string& sCtrlID)
|
||||
CCtrlShapeArc::CCtrlShapeArc(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ class CCtrlShapeArc : public CCtrlGeneralShape
|
||||
int m_nAxixY2;
|
||||
public:
|
||||
CCtrlShapeArc();
|
||||
CCtrlShapeArc(const STRING& sCtrlID);
|
||||
CCtrlShapeArc(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeArc& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -24,10 +24,4 @@ EConnectLineType GetConnectLineType(int nValue)
|
||||
CCtrlShapeConnectLine::CCtrlShapeConnectLine(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
|
||||
: CCtrlGeneralShape(sCtrlID, nSize, oBuffer, nOff, nVersion)
|
||||
{}
|
||||
|
||||
int CCtrlShapeConnectLine::ParseElement(CCtrlShapeConnectLine& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,9 +33,6 @@ class CCtrlShapeConnectLine : public CCtrlGeneralShape
|
||||
TConnectPoint m_oEndPt;
|
||||
public:
|
||||
CCtrlShapeConnectLine(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeConnectLine& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
static int ParseCtrl(CCtrlShapeConnectLine& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeCurve::CCtrlShapeCurve()
|
||||
{}
|
||||
|
||||
CCtrlShapeCurve::CCtrlShapeCurve(const std::string& sCtrlID)
|
||||
CCtrlShapeCurve::CCtrlShapeCurve(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -12,6 +12,8 @@ class CCtrlShapeCurve : public CCtrlGeneralShape
|
||||
std::vector<TPoint> m_arPoints;
|
||||
std::vector<BYTE> m_arSegmentType;
|
||||
public:
|
||||
CCtrlShapeCurve();
|
||||
CCtrlShapeCurve(const STRING& sCtrlID);
|
||||
CCtrlShapeCurve(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeCurve& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeEllipse::CCtrlShapeEllipse()
|
||||
{}
|
||||
|
||||
CCtrlShapeEllipse::CCtrlShapeEllipse(const std::string& sCtrlID)
|
||||
CCtrlShapeEllipse::CCtrlShapeEllipse(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ enum class EArcType
|
||||
CHORD
|
||||
};
|
||||
|
||||
EArcType GetArcType(int nValue)
|
||||
inline EArcType GetArcType(int nValue)
|
||||
{
|
||||
switch(static_cast<EArcType>(nValue))
|
||||
{
|
||||
@ -44,6 +44,8 @@ class CCtrlShapeEllipse : public CCtrlGeneralShape
|
||||
int m_nEndX2;
|
||||
int m_nEndY2;
|
||||
public:
|
||||
CCtrlShapeEllipse();
|
||||
CCtrlShapeEllipse(const STRING& sCtrlID);
|
||||
CCtrlShapeEllipse(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeEllipse& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeLine::CCtrlShapeLine()
|
||||
{}
|
||||
|
||||
CCtrlShapeLine::CCtrlShapeLine(const std::string& sCtrlID)
|
||||
CCtrlShapeLine::CCtrlShapeLine(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@ class CCtrlShapeLine : public CCtrlGeneralShape
|
||||
int m_nEndY;
|
||||
short m_shAttr;
|
||||
public:
|
||||
CCtrlShapeLine();
|
||||
CCtrlShapeLine(const STRING& sCtrlID);
|
||||
CCtrlShapeLine(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeLine& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeOle::CCtrlShapeOle()
|
||||
{}
|
||||
|
||||
CCtrlShapeOle::CCtrlShapeOle(const std::string& sCtrlID)
|
||||
CCtrlShapeOle::CCtrlShapeOle(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -15,6 +15,8 @@ class CCtrlShapeOle : public CCtrlGeneralShape
|
||||
int m_nBorderThick;
|
||||
int m_nBorderAttr;
|
||||
public:
|
||||
CCtrlShapeOle();
|
||||
CCtrlShapeOle(const STRING& sCtrlID);
|
||||
CCtrlShapeOle(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeOle& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -117,7 +117,7 @@ CCtrlShapePic::CCtrlShapePic()
|
||||
: CCtrlGeneralShape()
|
||||
{}
|
||||
|
||||
CCtrlShapePic::CCtrlShapePic(const std::string& sCtrlID)
|
||||
CCtrlShapePic::CCtrlShapePic(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -125,6 +125,8 @@ class CCtrlShapePic : public CCtrlGeneralShape
|
||||
int m_nIniPicHeight;
|
||||
BYTE m_chPicAlpha;
|
||||
public:
|
||||
CCtrlShapePic();
|
||||
CCtrlShapePic(const STRING& sCtrlID);
|
||||
CCtrlShapePic(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
~CCtrlShapePic();
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapePolygon::CCtrlShapePolygon()
|
||||
{}
|
||||
|
||||
CCtrlShapePolygon::CCtrlShapePolygon(const std::string& sCtrlID)
|
||||
CCtrlShapePolygon::CCtrlShapePolygon(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ class CCtrlShapePolygon : public CCtrlGeneralShape
|
||||
std::list<TPoint> m_arPoints;
|
||||
public:
|
||||
CCtrlShapePolygon();
|
||||
CCtrlShapePolygon(const STRING& sCtrlID);
|
||||
CCtrlShapePolygon(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapePolygon& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeRect::CCtrlShapeRect()
|
||||
{}
|
||||
|
||||
CCtrlShapeRect::CCtrlShapeRect(const std::string& sCtrlID)
|
||||
CCtrlShapeRect::CCtrlShapeRect(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@ class CCtrlShapeRect : public CCtrlGeneralShape
|
||||
BYTE m_chCurv;
|
||||
TPoint m_arPoints[4];
|
||||
public:
|
||||
CCtrlShapeRect();
|
||||
CCtrlShapeRect(const STRING& sCtrlID);
|
||||
CCtrlShapeRect(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeRect& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -5,7 +5,7 @@ namespace HWP
|
||||
CCtrlShapeTextArt::CCtrlShapeTextArt()
|
||||
{}
|
||||
|
||||
CCtrlShapeTextArt::CCtrlShapeTextArt(const std::string& sCtrlID)
|
||||
CCtrlShapeTextArt::CCtrlShapeTextArt(const STRING& sCtrlID)
|
||||
: CCtrlGeneralShape(sCtrlID)
|
||||
{}
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ class CCtrlShapeTextArt : public CCtrlGeneralShape
|
||||
|
||||
std::vector<TPoint> m_arOutline;
|
||||
public:
|
||||
CCtrlShapeTextArt();
|
||||
CCtrlShapeTextArt(const STRING& sCtrlID);
|
||||
CCtrlShapeTextArt(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeTextArt& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
@ -12,6 +12,7 @@ class CCtrlShapeVideo : public CCtrlGeneralShape
|
||||
STRING m_sWebURL;
|
||||
STRING m_sThumnailBinID;
|
||||
public:
|
||||
CCtrlShapeVideo(const STRING& sCtrlID);
|
||||
CCtrlShapeVideo(const STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
static int ParseElement(CCtrlShapeVideo& oObj, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
|
||||
Reference in New Issue
Block a user