The writing code for converting hwp format

This commit is contained in:
Green
2024-12-09 22:18:04 +03:00
parent b776b7b63f
commit a93f00d0af
18 changed files with 379 additions and 29 deletions

View File

@ -0,0 +1,55 @@
#include "NoteShape.h"
namespace HWP
{
ENoteNumbering GetNoteNumbering(int nValue)
{
switch(static_cast<ENoteNumbering>(nValue))
{
case ENoteNumbering::CONTINUOUS: return ENoteNumbering::CONTINUOUS;
case ENoteNumbering::ON_SECTION: return ENoteNumbering::ON_SECTION;
case ENoteNumbering::ON_PAGE: return ENoteNumbering::ON_PAGE;
default:
return ENoteNumbering::UNKNOWN;
}
}
CNoteShape::CNoteShape()
{}
CNoteShape* CNoteShape::Parse(int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
{
CNoteShape* pNoteShape = new CNoteShape();
if (nullptr == pNoteShape)
return nullptr;
pNoteShape->m_eNumberShape = GetNumberShape2(oBuffer.ReadByte());
BYTE chAttr;
oBuffer.ReadByte(chAttr);
pNoteShape->m_chPlacement = (BYTE)(chAttr & 0x03);
pNoteShape->m_eNumbering = GetNoteNumbering((chAttr >> 2) & 0x03);
pNoteShape->m_bSuperscript = CHECK_FLAG(chAttr >> 4, 0x01);
pNoteShape->m_bBeneathText = CHECK_FLAG(chAttr >> 5, 0x01);
oBuffer.Skip(2);
oBuffer.ReadChar(pNoteShape->m_chUserChar);
oBuffer.ReadChar(pNoteShape->m_chPrefixChar);
oBuffer.ReadChar(pNoteShape->m_chSuffixChar);
oBuffer.ReadShort(pNoteShape->m_shNewNumber);
oBuffer.ReadInt(pNoteShape->m_nNoteLineLength);
oBuffer.ReadShort(pNoteShape->m_shSpacingAboveLine);
oBuffer.ReadShort(pNoteShape->m_shSpacingBelowLine);
oBuffer.ReadShort(pNoteShape->m_shSpacingBetweenNotes);
pNoteShape->m_eNoteLineType = GetLineStyle1(oBuffer.ReadByte());
oBuffer.ReadByte(pNoteShape->m_chNoteLineWidth);
oBuffer.ReadColor(pNoteShape->m_nNoteLineColor);
return pNoteShape;
}
}