mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 05:24:10 +08:00
The writing code for converting hwp format
This commit is contained in:
55
HwpFile/HwpDoc/Section/NoteShape.cpp
Normal file
55
HwpFile/HwpDoc/Section/NoteShape.cpp
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user