mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Expanded support for the HWPML format
This commit is contained in:
@ -55,7 +55,10 @@ namespace SVG
|
|||||||
std::wstring wsImageData = m_wsHref.substr(unType + 8, m_wsHref.length() - unType - 8);
|
std::wstring wsImageData = m_wsHref.substr(unType + 8, m_wsHref.length() - unType - 8);
|
||||||
ulSize = NSBase64::Base64DecodeGetRequiredLength(wsImageData.length());
|
ulSize = NSBase64::Base64DecodeGetRequiredLength(wsImageData.length());
|
||||||
|
|
||||||
pBuffer = new BYTE[ulSize];
|
pBuffer = new(std::nothrow) BYTE[ulSize];
|
||||||
|
|
||||||
|
if (NULL == pBuffer)
|
||||||
|
return false;
|
||||||
|
|
||||||
NSBase64::Base64Decode(wsImageData.c_str(), wsImageData.length(), pBuffer, &(int&)ulSize);
|
NSBase64::Base64Decode(wsImageData.c_str(), wsImageData.length(), pBuffer, &(int&)ulSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,7 +131,6 @@ HEADERS += \
|
|||||||
HwpDoc/HWPElements/HWPRecordParaText.h \
|
HwpDoc/HWPElements/HWPRecordParaText.h \
|
||||||
HwpDoc/HWPElements/HWPRecordStyle.h \
|
HwpDoc/HWPElements/HWPRecordStyle.h \
|
||||||
HwpDoc/HWPElements/HWPTag.h \
|
HwpDoc/HWPElements/HWPTag.h \
|
||||||
HwpDoc/HWPElements/HWPType.h \
|
|
||||||
HwpDoc/HWPElements/HwpRecordTabDef.h \
|
HwpDoc/HWPElements/HwpRecordTabDef.h \
|
||||||
HwpDoc/HWPElements/HwpRecordTypes.h \
|
HwpDoc/HWPElements/HwpRecordTypes.h \
|
||||||
HwpDoc/HWPFile.h \
|
HwpDoc/HWPFile.h \
|
||||||
|
|||||||
@ -32,6 +32,7 @@ typedef char HWP_BYTE;
|
|||||||
#define WSTR(value) MAKE_WSTR(#value)
|
#define WSTR(value) MAKE_WSTR(#value)
|
||||||
|
|
||||||
#define IF_STRING_IN_ENUM(checked_value, value, enum_type)\
|
#define IF_STRING_IN_ENUM(checked_value, value, enum_type)\
|
||||||
|
TO_UPPER(value);\
|
||||||
if (WSTR(checked_value) == value)\
|
if (WSTR(checked_value) == value)\
|
||||||
return enum_type::checked_value
|
return enum_type::checked_value
|
||||||
#define ELSE_IF_STRING_IN_ENUM(checked_value, value, enum_type)\
|
#define ELSE_IF_STRING_IN_ENUM(checked_value, value, enum_type)\
|
||||||
|
|||||||
@ -90,7 +90,7 @@ enum class ENode
|
|||||||
InSideMargin,
|
InSideMargin,
|
||||||
Caption,
|
Caption,
|
||||||
TransformMatrix,
|
TransformMatrix,
|
||||||
ScaleMatrix,
|
ScaleMatrix, //80
|
||||||
RotationMatrix,
|
RotationMatrix,
|
||||||
LineShape,
|
LineShape,
|
||||||
ShadowEffect,
|
ShadowEffect,
|
||||||
@ -98,9 +98,16 @@ enum class ENode
|
|||||||
SoftEdgeEffect,
|
SoftEdgeEffect,
|
||||||
ReflectionEffect,
|
ReflectionEffect,
|
||||||
EffectsColor,
|
EffectsColor,
|
||||||
|
DrawText,
|
||||||
|
TextMargin,
|
||||||
|
Header, //90
|
||||||
|
Footer,
|
||||||
|
CellZoneList,
|
||||||
|
CellZone,
|
||||||
|
Row,
|
||||||
|
Cell,
|
||||||
|
|
||||||
//Only hwpx
|
//Only hwpx
|
||||||
Ctrl,
|
|
||||||
Lineseg,
|
Lineseg,
|
||||||
LinesegArray,
|
LinesegArray,
|
||||||
Video,
|
Video,
|
||||||
@ -112,7 +119,7 @@ enum class ENode
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_TYPES 2
|
#define MAX_TYPES 2
|
||||||
#define MAX_NODES 100
|
#define MAX_NODES 110
|
||||||
|
|
||||||
static constexpr const char* NODE_NAMES[MAX_TYPES][MAX_NODES] =
|
static constexpr const char* NODE_NAMES[MAX_TYPES][MAX_NODES] =
|
||||||
{
|
{
|
||||||
@ -209,14 +216,23 @@ static constexpr const char* NODE_NAMES[MAX_TYPES][MAX_NODES] =
|
|||||||
"hp:softEdge",
|
"hp:softEdge",
|
||||||
"hp:reflection",
|
"hp:reflection",
|
||||||
"hp:effectsColor",
|
"hp:effectsColor",
|
||||||
|
"hp:drawText",
|
||||||
|
"hp:textMargin",
|
||||||
|
"hp:header",
|
||||||
|
"hp:footer",
|
||||||
|
"hp:cellzoneList",
|
||||||
|
"hp:cellzone",
|
||||||
|
"hp:tr",
|
||||||
|
"hp:tc",
|
||||||
|
|
||||||
"hp:ctrl",
|
|
||||||
"hp:lineseg",
|
"hp:lineseg",
|
||||||
"hp:linesegarray",
|
"hp:linesegarray",
|
||||||
"hp:video",
|
"hp:video",
|
||||||
"hp:switch",
|
"hp:switch",
|
||||||
"hp:case",
|
"hp:case",
|
||||||
"hp:default"
|
"hp:default",
|
||||||
|
"hh:slash",
|
||||||
|
"hh:backSlash"
|
||||||
},
|
},
|
||||||
// HWPML
|
// HWPML
|
||||||
{
|
{
|
||||||
@ -310,6 +326,14 @@ static constexpr const char* NODE_NAMES[MAX_TYPES][MAX_NODES] =
|
|||||||
"SOFTEDGE",
|
"SOFTEDGE",
|
||||||
"REFLECTION",
|
"REFLECTION",
|
||||||
"EFFECTSCOLOR",
|
"EFFECTSCOLOR",
|
||||||
|
"DRAWTEXT",
|
||||||
|
"TEXTMARGIN",
|
||||||
|
"HEADER",
|
||||||
|
"FOOTER",
|
||||||
|
"CELLZONELIST",
|
||||||
|
"CELLZONE",
|
||||||
|
"ROW",
|
||||||
|
"CELL",
|
||||||
|
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@ -317,6 +341,7 @@ static constexpr const char* NODE_NAMES[MAX_TYPES][MAX_NODES] =
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
"",
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -331,6 +356,16 @@ inline const char* GetNodeName(ENode eNode, EHanType eType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool Equals(ENode eNode, EHanType eType, std::string sNodeName)
|
||||||
|
{
|
||||||
|
switch (eType)
|
||||||
|
{
|
||||||
|
case EHanType::HWPX: return NODE_NAMES[0][static_cast<int>(eNode)] == sNodeName;
|
||||||
|
case EHanType::HWPML: return NODE_NAMES[1][static_cast<int>(eNode)] == sNodeName;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum class EAttribute
|
enum class EAttribute
|
||||||
{
|
{
|
||||||
ParaShape,
|
ParaShape,
|
||||||
@ -462,7 +497,7 @@ enum class EAttribute
|
|||||||
MatrixElement1_2,
|
MatrixElement1_2,
|
||||||
MatrixElement2_1,
|
MatrixElement2_1,
|
||||||
MatrixElement2_2,
|
MatrixElement2_2,
|
||||||
MatrixElementOffsetX,
|
MatrixElementOffsetX, // 130
|
||||||
MatrixElementOffsetY,
|
MatrixElementOffsetY,
|
||||||
HeadStyle,
|
HeadStyle,
|
||||||
HeadSize,
|
HeadSize,
|
||||||
@ -472,13 +507,22 @@ enum class EAttribute
|
|||||||
Direction,
|
Direction,
|
||||||
Distance,
|
Distance,
|
||||||
RotationStyle,
|
RotationStyle,
|
||||||
FadeDirection,
|
FadeDirection, //140
|
||||||
|
BinData,
|
||||||
|
RepeatHeader,
|
||||||
|
RowCount,
|
||||||
|
ColCount,
|
||||||
|
CellSpacing,
|
||||||
|
StartRowAddr,
|
||||||
|
StartColAddr,
|
||||||
|
EndRowAddr,
|
||||||
|
EndColAddr,
|
||||||
|
|
||||||
PageBreak,
|
PageBreak,
|
||||||
ColumnBreak,
|
ColumnBreak,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_ATTRIBUTES 150
|
#define MAX_ATTRIBUTES 160
|
||||||
|
|
||||||
//TODO:: добавить все аргументы
|
//TODO:: добавить все аргументы
|
||||||
static constexpr const char* ATTRUBUTE_NAMES[MAX_TYPES][MAX_ATTRIBUTES] =
|
static constexpr const char* ATTRUBUTE_NAMES[MAX_TYPES][MAX_ATTRIBUTES] =
|
||||||
@ -569,10 +613,10 @@ static constexpr const char* ATTRUBUTE_NAMES[MAX_TYPES][MAX_ATTRIBUTES] =
|
|||||||
"eAsianEng",
|
"eAsianEng",
|
||||||
"eAsianNum",
|
"eAsianNum",
|
||||||
"indent",
|
"indent",
|
||||||
"top",
|
"left",
|
||||||
"bottom",
|
"right",
|
||||||
"",
|
"prev",
|
||||||
"",
|
"next",
|
||||||
"",
|
"",
|
||||||
"", //90
|
"", //90
|
||||||
"borderFillIDRef",
|
"borderFillIDRef",
|
||||||
@ -585,7 +629,7 @@ static constexpr const char* ATTRUBUTE_NAMES[MAX_TYPES][MAX_ATTRIBUTES] =
|
|||||||
"engName",
|
"engName",
|
||||||
"nextStyleIDRef",
|
"nextStyleIDRef",
|
||||||
"langID", //100
|
"langID", //100
|
||||||
"id"
|
"id",
|
||||||
"lockForm",
|
"lockForm",
|
||||||
"name",
|
"name",
|
||||||
"textFlow",
|
"textFlow",
|
||||||
@ -625,6 +669,15 @@ static constexpr const char* ATTRUBUTE_NAMES[MAX_TYPES][MAX_ATTRIBUTES] =
|
|||||||
"distance",
|
"distance",
|
||||||
"rotationStyle",
|
"rotationStyle",
|
||||||
"fadeDirection",
|
"fadeDirection",
|
||||||
|
"id",
|
||||||
|
"repeatHeader",
|
||||||
|
"rowCnt",
|
||||||
|
"colCnt",
|
||||||
|
"cellSpacing",
|
||||||
|
"startRowAddr",
|
||||||
|
"startColAddr",
|
||||||
|
"endRowAddr",
|
||||||
|
"endColAddr",
|
||||||
|
|
||||||
"pageBreak",
|
"pageBreak",
|
||||||
"columnBreak",
|
"columnBreak",
|
||||||
@ -771,6 +824,15 @@ static constexpr const char* ATTRUBUTE_NAMES[MAX_TYPES][MAX_ATTRIBUTES] =
|
|||||||
"Distance",
|
"Distance",
|
||||||
"RotationStyle",
|
"RotationStyle",
|
||||||
"FadeDirection",
|
"FadeDirection",
|
||||||
|
"BinData",
|
||||||
|
"RepeatHeader",
|
||||||
|
"RowCount",
|
||||||
|
"ColCount",
|
||||||
|
"CellSpacing",
|
||||||
|
"StartRowAddr",
|
||||||
|
"StartColAddr",
|
||||||
|
"EndRowAddr",
|
||||||
|
"EndColAddr",
|
||||||
|
|
||||||
"PageBreak",
|
"PageBreak",
|
||||||
"ColumnBreak"
|
"ColumnBreak"
|
||||||
@ -787,6 +849,16 @@ inline const char* GetAttributeName(EAttribute eNode, EHanType eType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool Equals(EAttribute eAttribute, EHanType eType, std::string sAttributeName)
|
||||||
|
{
|
||||||
|
switch (eType)
|
||||||
|
{
|
||||||
|
case EHanType::HWPX: return ATTRUBUTE_NAMES[0][static_cast<int>(eAttribute)] == sAttributeName;
|
||||||
|
case EHanType::HWPML: return ATTRUBUTE_NAMES[1][static_cast<int>(eAttribute)] == sAttributeName;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define MAX_VALUES 60
|
#define MAX_VALUES 60
|
||||||
|
|
||||||
// TODO:: пока всё в одном месте. Возможно стоит лучше разделить по соответствующим классам
|
// TODO:: пока всё в одном месте. Возможно стоит лучше разделить по соответствующим классам
|
||||||
@ -896,7 +968,14 @@ static constexpr const char* VALUE_NAMES[MAX_TYPES][MAX_VALUES] =
|
|||||||
"MEDIUM_LARGE",
|
"MEDIUM_LARGE",
|
||||||
"LARGE_SMALL",
|
"LARGE_SMALL",
|
||||||
"LARGE_MEDIUM",
|
"LARGE_MEDIUM",
|
||||||
"LARGE_LARGE"
|
"LARGE_LARGE",
|
||||||
|
"NORMAL",
|
||||||
|
"ARROW",
|
||||||
|
"SPEAR",
|
||||||
|
"CONCAVE_ARROW",
|
||||||
|
"EMPTY_DIAMOND",
|
||||||
|
"EMPTY_CIRCLE",
|
||||||
|
"EMPTY_BOX"
|
||||||
},
|
},
|
||||||
//HWPML
|
//HWPML
|
||||||
{
|
{
|
||||||
@ -945,7 +1024,14 @@ static constexpr const char* VALUE_NAMES[MAX_TYPES][MAX_VALUES] =
|
|||||||
"MediumLarge",
|
"MediumLarge",
|
||||||
"LargeSmall",
|
"LargeSmall",
|
||||||
"LargeMedium",
|
"LargeMedium",
|
||||||
"LargeLarge"
|
"LargeLarge",
|
||||||
|
"Normal",
|
||||||
|
"Arrow",
|
||||||
|
"Spear",
|
||||||
|
"ConcaveArrow",
|
||||||
|
"EmptyDiamond",
|
||||||
|
"EmptyCircle",
|
||||||
|
"EmptyBox"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -336,6 +336,11 @@ bool CWriterContext::GetBinBytes(const HWP_STRING& sId, CHWPStream& oBuffer, HWP
|
|||||||
sFileName = NSFile::GetFileName(pBinData->GetPath());
|
sFileName = NSFile::GetFileName(pBinData->GetPath());
|
||||||
return m_pHWPXFile->GetChildStream(pBinData->GetPath(), oBuffer);
|
return m_pHWPXFile->GetChildStream(pBinData->GetPath(), oBuffer);
|
||||||
}
|
}
|
||||||
|
case EHanType::HWPML:
|
||||||
|
{
|
||||||
|
sFileName = pBinData->GetItemID() + L'.' + pBinData->GetFormat();
|
||||||
|
return m_pHWPMLFile->GetBinData(pBinData->GetItemID(), oBuffer);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -596,7 +596,8 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
|
|||||||
}
|
}
|
||||||
case ECtrlObjectType::HeadFoot:
|
case ECtrlObjectType::HeadFoot:
|
||||||
{
|
{
|
||||||
if (EHanType::HWPX == m_pContext->GetType())
|
if (EHanType::HWPX == m_pContext->GetType() ||
|
||||||
|
EHanType::HWPML == m_pContext->GetType())
|
||||||
oState.m_arCtrlsHeadFoot.push_back((const CCtrlHeadFoot*)pCtrl);
|
oState.m_arCtrlsHeadFoot.push_back((const CCtrlHeadFoot*)pCtrl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1245,12 +1246,22 @@ void CConverter2OOXML::WriteSectionSettings(TConversionState& oState)
|
|||||||
{
|
{
|
||||||
std::vector<const CCtrlHeadFoot*> arCtrlsHeadFoot;
|
std::vector<const CCtrlHeadFoot*> arCtrlsHeadFoot;
|
||||||
|
|
||||||
if (EHanType::HWP == m_pContext->GetType())
|
switch (m_pContext->GetType())
|
||||||
arCtrlsHeadFoot = oState.m_pSectionDef->GetHeaderFooters();
|
|
||||||
else if (EHanType::HWPX == m_pContext->GetType())
|
|
||||||
{
|
{
|
||||||
arCtrlsHeadFoot = oState.m_arCtrlsHeadFoot;
|
case EHanType::HWP:
|
||||||
oState.m_arCtrlsHeadFoot.clear();
|
{
|
||||||
|
arCtrlsHeadFoot = oState.m_pSectionDef->GetHeaderFooters();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EHanType::HWPX:
|
||||||
|
case EHanType::HWPML:
|
||||||
|
{
|
||||||
|
arCtrlsHeadFoot = oState.m_arCtrlsHeadFoot;
|
||||||
|
oState.m_arCtrlsHeadFoot.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WRITE_ID(id)\
|
#define WRITE_ID(id)\
|
||||||
@ -2000,7 +2011,8 @@ void CConverter2OOXML::WriteBorderSettings(const CCtrlShapePic* pCtrlPic, NSStri
|
|||||||
|
|
||||||
if (EHanType::HWP == m_pContext->GetType())
|
if (EHanType::HWP == m_pContext->GetType())
|
||||||
WriteLineSettings(pCtrlPic->GetBorderLineStyle(), pCtrlPic->GetBorderColor(), pCtrlPic->GetBorderThick(), pCtrlPic->GetBorderCompoundLineType(), oBuilder);
|
WriteLineSettings(pCtrlPic->GetBorderLineStyle(), pCtrlPic->GetBorderColor(), pCtrlPic->GetBorderThick(), pCtrlPic->GetBorderCompoundLineType(), oBuilder);
|
||||||
else if (EHanType::HWPX == m_pContext->GetType())
|
else if (EHanType::HWPX == m_pContext->GetType() ||
|
||||||
|
EHanType::HWPML == m_pContext->GetType())
|
||||||
WriteLineSettings(pCtrlPic->GetLineStyle(), pCtrlPic->GetLineColor(), pCtrlPic->GetLineThick(), 1, oBuilder);
|
WriteLineSettings(pCtrlPic->GetLineStyle(), pCtrlPic->GetLineColor(), pCtrlPic->GetLineThick(), 1, oBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,11 +24,9 @@ namespace Transform
|
|||||||
|
|
||||||
inline std::wstring IntColorToHEX(int nColor)
|
inline std::wstring IntColorToHEX(int nColor)
|
||||||
{
|
{
|
||||||
std::wstringstream oSStream;
|
wchar_t buffer[7];
|
||||||
|
std::swprintf(buffer, L"%02X%02X%02X", nColor & 0xFF, (nColor >> 8) & 0xFF, (nColor >> 16) & 0xFF);
|
||||||
oSStream << std::uppercase << std::hex << std::setw(6) << std::setfill(L'0') << nColor;
|
return std::wstring(buffer);
|
||||||
|
|
||||||
return oSStream.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline short LineWidth2Pt(short shHWPThick)
|
inline short LineWidth2Pt(short shHWPThick)
|
||||||
|
|||||||
@ -45,9 +45,9 @@ namespace HWP
|
|||||||
const int tempLen = 7;
|
const int tempLen = 7;
|
||||||
wchar_t arTemp[tempLen];
|
wchar_t arTemp[tempLen];
|
||||||
|
|
||||||
swprintf(arTemp, tempLen, L"%02X%02X%02X", m_uchRed, m_uchGreen, m_uchBlue);
|
swprintf(arTemp, tempLen, L"%02X%02X%02X", m_uchBlue, m_uchGreen, m_uchRed);
|
||||||
|
|
||||||
return std::wstring(arTemp, 6);
|
return std::wstring(arTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -376,6 +376,7 @@ const CHWPRecord* CHWPDocInfo::GetBinData(const HWP_STRING& sID) const
|
|||||||
{
|
{
|
||||||
case EHanType::HWP:
|
case EHanType::HWP:
|
||||||
case EHanType::HWPX:
|
case EHanType::HWPX:
|
||||||
|
case EHanType::HWPML:
|
||||||
{
|
{
|
||||||
std::map<HWP_STRING, CHWPRecord*>::const_iterator itFound = m_mBinDatas.find(sID);
|
std::map<HWP_STRING, CHWPRecord*>::const_iterator itFound = m_mBinDatas.find(sID);
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ CHWPRecordBinData::CHWPRecordBinData(CXMLReader& oReader, int nVersion, EHanType
|
|||||||
|
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
{
|
{
|
||||||
if ("id" == sAttributeName)
|
if (GetAttributeName(EAttribute::BinData, eType) == sAttributeName)
|
||||||
m_sItemID = oReader.GetText();
|
m_sItemID = oReader.GetText();
|
||||||
else if (EHanType::HWPX == eType && "isEmbeded" == sAttributeName)
|
else if (EHanType::HWPX == eType && "isEmbeded" == sAttributeName)
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ CHWPRecordBinData::CHWPRecordBinData(CXMLReader& oReader, int nVersion, EHanType
|
|||||||
|
|
||||||
if (EType::LINK != m_eType || sSubPath.empty())
|
if (EType::LINK != m_eType || sSubPath.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sAPath = sSubPath;
|
m_sAPath = sSubPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -405,7 +405,7 @@ CHWPRecordBorderFill::CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, CXMLReader& oR
|
|||||||
m_oDiagonal.Read(oReader, eType);
|
m_oDiagonal.Read(oReader, eType);
|
||||||
else if (GetNodeName(ENode::FillBrush, eType) == sNodeName)
|
else if (GetNodeName(ENode::FillBrush, eType) == sNodeName)
|
||||||
m_pFill = new CFill(oReader, eType);
|
m_pFill = new CFill(oReader, eType);
|
||||||
else if (GetNodeName(ENode::Slash, eType) == sNodeName)
|
else if (Equals(ENode::Slash, eType, sNodeName))
|
||||||
{
|
{
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,7 +19,7 @@ EAccent GetAccent(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EAccent GetAccent(const HWP_STRING& sValue)
|
EAccent GetAccent(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(DOT, sValue, EAccent);
|
IF_STRING_IN_ENUM(DOT, sValue, EAccent);
|
||||||
ELSE_IF_STRING_IN_ENUM(RING, sValue, EAccent);
|
ELSE_IF_STRING_IN_ENUM(RING, sValue, EAccent);
|
||||||
@ -59,7 +59,7 @@ EUnderline GetUnderline(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EUnderline GetUnderline(const HWP_STRING& sValue)
|
EUnderline GetUnderline(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(BOTTOM, sValue, EUnderline);
|
IF_STRING_IN_ENUM(BOTTOM, sValue, EUnderline);
|
||||||
ELSE_IF_STRING_IN_ENUM(CENTER, sValue, EUnderline);
|
ELSE_IF_STRING_IN_ENUM(CENTER, sValue, EUnderline);
|
||||||
@ -81,7 +81,7 @@ EOutline GetOutline(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EOutline GetOutline(const HWP_STRING& sValue)
|
EOutline GetOutline(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(SOLID, sValue, EOutline);
|
IF_STRING_IN_ENUM(SOLID, sValue, EOutline);
|
||||||
ELSE_IF_STRING_IN_ENUM(DOTTED, sValue, EOutline);
|
ELSE_IF_STRING_IN_ENUM(DOTTED, sValue, EOutline);
|
||||||
@ -102,7 +102,7 @@ EShadow GetShadow(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EShadow GetShadow(const HWP_STRING& sValue)
|
EShadow GetShadow(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(DISCRETE, sValue, EShadow);
|
IF_STRING_IN_ENUM(DISCRETE, sValue, EShadow);
|
||||||
ELSE_IF_STRING_IN_ENUM(CONTINUOUS, sValue, EShadow);
|
ELSE_IF_STRING_IN_ENUM(CONTINUOUS, sValue, EShadow);
|
||||||
|
|||||||
@ -60,7 +60,7 @@ enum class EAccent
|
|||||||
};
|
};
|
||||||
|
|
||||||
EAccent GetAccent(int nValue);
|
EAccent GetAccent(int nValue);
|
||||||
EAccent GetAccent(const HWP_STRING& sValue);
|
EAccent GetAccent(HWP_STRING sValue);
|
||||||
|
|
||||||
#define MAX_ELEMENTS (int)ELang::MAX
|
#define MAX_ELEMENTS (int)ELang::MAX
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ EHeadingType GetHeadingType(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EHeadingType GetHeadingType(const HWP_STRING& sValue)
|
EHeadingType GetHeadingType(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(OUTLINE, sValue, EHeadingType);
|
IF_STRING_IN_ENUM(OUTLINE, sValue, EHeadingType);
|
||||||
ELSE_IF_STRING_IN_ENUM(NUMBER, sValue, EHeadingType);
|
ELSE_IF_STRING_IN_ENUM(NUMBER, sValue, EHeadingType);
|
||||||
@ -36,7 +36,7 @@ EHorizontalAlign GetHorizontalAlign(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EHorizontalAlign GetHorizontalAlign(const HWP_STRING& sValue)
|
EHorizontalAlign GetHorizontalAlign(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(RIGHT, sValue, EHorizontalAlign);
|
IF_STRING_IN_ENUM(RIGHT, sValue, EHorizontalAlign);
|
||||||
ELSE_IF_STRING_IN_ENUM(CENTER, sValue, EHorizontalAlign);
|
ELSE_IF_STRING_IN_ENUM(CENTER, sValue, EHorizontalAlign);
|
||||||
@ -57,7 +57,7 @@ EVerticalAlign GetVerticalAlign(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EVerticalAlign GetVerticalAlign(const HWP_STRING& sValue)
|
EVerticalAlign GetVerticalAlign(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(CENTER, sValue, EVerticalAlign);
|
IF_STRING_IN_ENUM(CENTER, sValue, EVerticalAlign);
|
||||||
ELSE_IF_STRING_IN_ENUM(BOTTOM, sValue, EVerticalAlign);
|
ELSE_IF_STRING_IN_ENUM(BOTTOM, sValue, EVerticalAlign);
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
#ifndef HWPTYPE_H
|
|
||||||
#define HWPTYPE_H
|
|
||||||
|
|
||||||
#include "HWPTag.h"
|
|
||||||
|
|
||||||
namespace HWP
|
|
||||||
{
|
|
||||||
class CHWPType
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CHWPType(){};
|
|
||||||
|
|
||||||
EHWPTag m_eTag;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HWPTYPE_H
|
|
||||||
@ -50,7 +50,7 @@ inline ELineStyle1 GetLineStyle1(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ELineStyle1 GetLineStyle1(const HWP_STRING& sValue)
|
inline ELineStyle1 GetLineStyle1(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(SOLID, sValue, ELineStyle1);
|
IF_STRING_IN_ENUM(SOLID, sValue, ELineStyle1);
|
||||||
ELSE_IF_STRING_IN_ENUM(DASH, sValue, ELineStyle1);
|
ELSE_IF_STRING_IN_ENUM(DASH, sValue, ELineStyle1);
|
||||||
@ -107,7 +107,7 @@ inline ELineStyle2 GetLineStyle2(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ELineStyle2 GetLineStyle2(const HWP_STRING& sValue)
|
inline ELineStyle2 GetLineStyle2(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(NONE, sValue, ELineStyle2);
|
IF_STRING_IN_ENUM(NONE, sValue, ELineStyle2);
|
||||||
ELSE_IF_STRING_IN_ENUM(SOLID, sValue, ELineStyle2);
|
ELSE_IF_STRING_IN_ENUM(SOLID, sValue, ELineStyle2);
|
||||||
@ -165,7 +165,7 @@ inline ENumberShape1 GetNumberShape1(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ENumberShape1 GetNumberShape1(const HWP_STRING& sValue)
|
inline ENumberShape1 GetNumberShape1(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(DIGIT, sValue, ENumberShape1);
|
IF_STRING_IN_ENUM(DIGIT, sValue, ENumberShape1);
|
||||||
ELSE_IF_STRING_IN_ENUM(CIRCLE_DIGIT, sValue, ENumberShape1);
|
ELSE_IF_STRING_IN_ENUM(CIRCLE_DIGIT, sValue, ENumberShape1);
|
||||||
@ -234,7 +234,7 @@ inline ENumberShape2 GetNumberShape2(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ENumberShape2 GetNumberShape2(const HWP_STRING& sValue)
|
inline ENumberShape2 GetNumberShape2(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(DIGIT, sValue, ENumberShape2);
|
IF_STRING_IN_ENUM(DIGIT, sValue, ENumberShape2);
|
||||||
ELSE_IF_STRING_IN_ENUM(CIRCLE_DIGIT, sValue, ENumberShape2);
|
ELSE_IF_STRING_IN_ENUM(CIRCLE_DIGIT, sValue, ENumberShape2);
|
||||||
@ -290,7 +290,7 @@ inline ELineArrowStyle GetLineArrowStyle(int nNum, bool bFill)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ELineArrowStyle GetLineArrowStyle(const HWP_STRING& sValue)
|
inline ELineArrowStyle GetLineArrowStyle(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(NORMAL, sValue, ELineArrowStyle);
|
IF_STRING_IN_ENUM(NORMAL, sValue, ELineArrowStyle);
|
||||||
ELSE_IF_STRING_IN_ENUM(ARROW, sValue, ELineArrowStyle);
|
ELSE_IF_STRING_IN_ENUM(ARROW, sValue, ELineArrowStyle);
|
||||||
@ -334,7 +334,7 @@ inline ELineArrowSize GetLineArrowSize(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ELineArrowSize GetLineArrowSize(const HWP_STRING& sValue)
|
inline ELineArrowSize GetLineArrowSize(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(SMALL_SMALL, sValue, ELineArrowSize);
|
IF_STRING_IN_ENUM(SMALL_SMALL, sValue, ELineArrowSize);
|
||||||
ELSE_IF_STRING_IN_ENUM(SMALL_MEDIUM, sValue, ELineArrowSize);
|
ELSE_IF_STRING_IN_ENUM(SMALL_MEDIUM, sValue, ELineArrowSize);
|
||||||
|
|||||||
@ -14,9 +14,9 @@ CHWPMLFile::~CHWPMLFile()
|
|||||||
{
|
{
|
||||||
CLEAR_ARRAY(CHWPSection, m_arSections);
|
CLEAR_ARRAY(CHWPSection, m_arSections);
|
||||||
|
|
||||||
for (std::pair<unsigned int, BYTE*> oValue : m_mBinDates)
|
for (BinMap::iterator itBegin = m_mBinDates.begin(); itBegin != m_mBinDates.end(); ++itBegin)
|
||||||
if (nullptr != oValue.second)
|
if (nullptr != itBegin->second)
|
||||||
delete[] oValue.second;
|
delete itBegin->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHWPMLFile::Open()
|
bool CHWPMLFile::Open()
|
||||||
@ -107,7 +107,7 @@ void CHWPMLFile::ReadBinData(CXMLReader &oReader)
|
|||||||
{
|
{
|
||||||
size_t unSize = 0;
|
size_t unSize = 0;
|
||||||
std::string sEncoding;
|
std::string sEncoding;
|
||||||
unsigned int unID = 0;
|
HWP_STRING sId;
|
||||||
bool bCompress = true;
|
bool bCompress = true;
|
||||||
|
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
@ -117,42 +117,39 @@ void CHWPMLFile::ReadBinData(CXMLReader &oReader)
|
|||||||
else if ("Encoding" == sAttributeName)
|
else if ("Encoding" == sAttributeName)
|
||||||
sEncoding = oReader.GetTextA();
|
sEncoding = oReader.GetTextA();
|
||||||
else if ("Id" == sAttributeName)
|
else if ("Id" == sAttributeName)
|
||||||
unID = oReader.GetInt();
|
sId = oReader.GetText();
|
||||||
else if ("Compress" == sAttributeName)
|
else if ("Compress" == sAttributeName)
|
||||||
bCompress = oReader.GetBool();
|
bCompress = oReader.GetBool();
|
||||||
}
|
}
|
||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
|
|
||||||
|
if (sId.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
const std::wstring wsImageData{oReader.GetText()};
|
const std::wstring wsImageData{oReader.GetText()};
|
||||||
|
|
||||||
if (0 == unSize)
|
int nImageSize = NSBase64::Base64DecodeGetRequiredLength(wsImageData.length());
|
||||||
unSize = wsImageData.length();
|
|
||||||
|
|
||||||
int nImageSize = NSBase64::Base64DecodeGetRequiredLength(unSize);
|
BYTE* pBuffer = new(std::nothrow) BYTE[nImageSize];
|
||||||
|
|
||||||
BYTE* pBuffer = new BYTE[nImageSize];
|
|
||||||
|
|
||||||
if (nullptr == pBuffer)
|
if (nullptr == pBuffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FALSE == NSBase64::Base64Decode(wsImageData.c_str(), unSize, pBuffer, &nImageSize))
|
if (FALSE == NSBase64::Base64Decode(wsImageData.c_str(), wsImageData.length(), pBuffer, &nImageSize))
|
||||||
{
|
{
|
||||||
delete[] pBuffer;
|
delete[] pBuffer;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<unsigned int, BYTE*>::iterator itFound = m_mBinDates.find(unID);
|
BinMap::iterator itFound = m_mBinDates.find(sId);
|
||||||
|
|
||||||
if (m_mBinDates.end() != itFound)
|
if (m_mBinDates.end() != itFound)
|
||||||
{
|
{
|
||||||
if (nullptr != itFound->second)
|
((CHWPStream*)itFound->second)->Clear();
|
||||||
delete[] itFound->second;
|
((CHWPStream*)itFound->second)->SetStream((HWP_BYTE*)pBuffer, nImageSize, false);
|
||||||
|
|
||||||
itFound->second = pBuffer;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
m_mBinDates.insert(std::make_pair(unID, pBuffer));
|
m_mBinDates.insert(std::make_pair(sId, new CHWPStream((HWP_BYTE*)pBuffer, nImageSize, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTOR<const CHWPSection*> CHWPMLFile::GetSections() const
|
VECTOR<const CHWPSection*> CHWPMLFile::GetSections() const
|
||||||
@ -160,13 +157,15 @@ VECTOR<const CHWPSection*> CHWPMLFile::GetSections() const
|
|||||||
RETURN_VECTOR_CONST_PTR(CHWPSection, m_arSections);
|
RETURN_VECTOR_CONST_PTR(CHWPSection, m_arSections);
|
||||||
}
|
}
|
||||||
|
|
||||||
const BYTE *HWP::CHWPMLFile::GetBinData(unsigned int unID) const
|
bool CHWPMLFile::GetBinData(const HWP_STRING &sId, CHWPStream &oBuffer) const
|
||||||
{
|
{
|
||||||
std::map<unsigned int, BYTE*>::const_iterator itFound = m_mBinDates.find(unID);
|
BinMap::const_iterator itFound = m_mBinDates.find(sId);
|
||||||
|
|
||||||
if (m_mBinDates.end() == itFound)
|
if (m_mBinDates.cend() == itFound || nullptr == itFound->second)
|
||||||
return nullptr;
|
return false;
|
||||||
|
|
||||||
return itFound->second;
|
oBuffer.SetStream(((CHWPStream*)(itFound->second))->GetCurPtr(), ((CHWPStream*)(itFound->second))->SizeToEnd());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,11 +8,13 @@ namespace HWP
|
|||||||
{
|
{
|
||||||
class CHWPMLFile
|
class CHWPMLFile
|
||||||
{
|
{
|
||||||
|
using BinMap = std::map <HWP_STRING, CHWPStream*>;
|
||||||
|
|
||||||
HWP_STRING m_wsFilePath;
|
HWP_STRING m_wsFilePath;
|
||||||
CHWPDocInfo m_oDocInfo;
|
CHWPDocInfo m_oDocInfo;
|
||||||
VECTOR<CHWPSection*> m_arSections;
|
VECTOR<CHWPSection*> m_arSections;
|
||||||
std::map<unsigned int, BYTE*> m_mBinDates;
|
BinMap m_mBinDates;
|
||||||
|
|
||||||
void ReadHead(CXMLReader& oReader);
|
void ReadHead(CXMLReader& oReader);
|
||||||
void ReadBody(CXMLReader& oReader);
|
void ReadBody(CXMLReader& oReader);
|
||||||
void ReadTail(CXMLReader& oReader);
|
void ReadTail(CXMLReader& oReader);
|
||||||
@ -29,7 +31,7 @@ public:
|
|||||||
|
|
||||||
const CHWPDocInfo* GetDocInfo() const;
|
const CHWPDocInfo* GetDocInfo() const;
|
||||||
VECTOR<const CHWPSection*> GetSections() const;
|
VECTOR<const CHWPSection*> GetSections() const;
|
||||||
const BYTE* GetBinData(unsigned int unID) const;
|
bool GetBinData(const HWP_STRING& sId, CHWPStream& oBuffer) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,6 +55,11 @@ HWP_BYTE* CHWPStream::GetCurPtr()
|
|||||||
return m_pCur;
|
return m_pCur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const HWP_BYTE *CHWPStream::GetCurPtr() const
|
||||||
|
{
|
||||||
|
return m_pCur;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long CHWPStream::Tell() const
|
unsigned long CHWPStream::Tell() const
|
||||||
{
|
{
|
||||||
return (!IsValid()) ? 0 : m_pCur - m_pBegin;
|
return (!IsValid()) ? 0 : m_pCur - m_pBegin;
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public:
|
|||||||
void SetStream(HWP_BYTE* pBuffer, unsigned long ulSize, bool bExternalBuffer = true);
|
void SetStream(HWP_BYTE* pBuffer, unsigned long ulSize, bool bExternalBuffer = true);
|
||||||
|
|
||||||
HWP_BYTE* GetCurPtr();
|
HWP_BYTE* GetCurPtr();
|
||||||
|
const HWP_BYTE* GetCurPtr() const;
|
||||||
unsigned long Tell() const;
|
unsigned long Tell() const;
|
||||||
unsigned long SizeToEnd() const;
|
unsigned long SizeToEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,10 @@ namespace HWP
|
|||||||
{
|
{
|
||||||
CCellParagraph::CCellParagraph()
|
CCellParagraph::CCellParagraph()
|
||||||
: CHWPPargraph()
|
: CHWPPargraph()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
CCellParagraph::CCellParagraph(CXMLReader& oReader, int nVersion)
|
CCellParagraph::CCellParagraph(CXMLReader& oReader, int nVersion, EHanType eType)
|
||||||
: CHWPPargraph(oReader, nVersion, EHanType::HWPX)
|
: CHWPPargraph(oReader, nVersion, eType)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
EParagraphType CCellParagraph::GetType() const
|
EParagraphType CCellParagraph::GetType() const
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class CCellParagraph : public CHWPPargraph
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCellParagraph();
|
CCellParagraph();
|
||||||
CCellParagraph(CXMLReader& oReader, int nVersion);
|
CCellParagraph(CXMLReader& oReader, int nVersion, EHanType eType);
|
||||||
|
|
||||||
EParagraphType GetType() const override;
|
EParagraphType GetType() const override;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,6 +8,8 @@
|
|||||||
#include "CtrlPageNumPos.h"
|
#include "CtrlPageNumPos.h"
|
||||||
#include "CtrlField.h"
|
#include "CtrlField.h"
|
||||||
|
|
||||||
|
#include "../Common/NodeNames.h"
|
||||||
|
|
||||||
namespace HWP
|
namespace HWP
|
||||||
{
|
{
|
||||||
CCtrl::CCtrl()
|
CCtrl::CCtrl()
|
||||||
@ -50,16 +52,16 @@ bool CCtrl::Equals(CCtrl* pFirstCtrl, CCtrl* pSecondCtrl)
|
|||||||
pFirstCtrl->m_bFullFilled == pSecondCtrl->m_bFullFilled;
|
pFirstCtrl->m_bFullFilled == pSecondCtrl->m_bFullFilled;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCtrl* CCtrl::GetCtrl(CXMLReader& oReader, int nVersion)
|
CCtrl* CCtrl::GetCtrl(CXMLReader& oReader, int nVersion, EHanType eType)
|
||||||
{
|
{
|
||||||
const std::string sNodeName{oReader.GetName()};
|
const std::string sNodeName{oReader.GetName()};
|
||||||
|
|
||||||
if ("hp:colPr" == sNodeName)
|
if ("hp:colPr" == sNodeName)
|
||||||
return new CCtrlColumnDef(L"dloc", oReader, nVersion);
|
return new CCtrlColumnDef(L"dloc", oReader, nVersion);
|
||||||
else if ("hp:header" == sNodeName)
|
else if (GetNodeName(ENode::Header, eType) == sNodeName)
|
||||||
return new CCtrlHeadFoot(L"daeh", oReader, nVersion);
|
return new CCtrlHeadFoot(L"daeh", oReader, nVersion, eType);
|
||||||
else if ("hp:footer" == sNodeName)
|
else if (GetNodeName(ENode::Footer, eType) == sNodeName)
|
||||||
return new CCtrlHeadFoot(L"toof", oReader, nVersion);
|
return new CCtrlHeadFoot(L"toof", oReader, nVersion, eType);
|
||||||
else if ("hp:footNote" == sNodeName)
|
else if ("hp:footNote" == sNodeName)
|
||||||
return new CCtrlNote(L" nf", oReader, nVersion);
|
return new CCtrlNote(L" nf", oReader, nVersion);
|
||||||
else if ("hp:endNote" == sNodeName)
|
else if ("hp:endNote" == sNodeName)
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef CTRL_H
|
#ifndef CTRL_H
|
||||||
#define CTRL_H
|
#define CTRL_H
|
||||||
|
|
||||||
|
#include "../HanType.h"
|
||||||
|
|
||||||
#include "../Common/Common.h"
|
#include "../Common/Common.h"
|
||||||
#include "../Common/XMLReader.h"
|
#include "../Common/XMLReader.h"
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ public:
|
|||||||
void SetFullFilled();
|
void SetFullFilled();
|
||||||
|
|
||||||
static bool Equals(CCtrl* pFirstCtrl, CCtrl* pSecondCtrl);
|
static bool Equals(CCtrl* pFirstCtrl, CCtrl* pSecondCtrl);
|
||||||
static CCtrl* GetCtrl(CXMLReader& oReader, int nVersion);
|
static CCtrl* GetCtrl(CXMLReader& oReader, int nVersion, EHanType eType);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ ENumType GetNumType(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ENumType GetNumType(const HWP_STRING& sValue)
|
ENumType GetNumType(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(FOOTNOTE, sValue, ENumType);
|
IF_STRING_IN_ENUM(FOOTNOTE, sValue, ENumType);
|
||||||
ELSE_IF_STRING_IN_ENUM(ENDNOTE, sValue, ENumType);
|
ELSE_IF_STRING_IN_ENUM(ENDNOTE, sValue, ENumType);
|
||||||
|
|||||||
@ -21,7 +21,7 @@ enum class ENumType
|
|||||||
};
|
};
|
||||||
|
|
||||||
ENumType GetNumType(int nValue);
|
ENumType GetNumType(int nValue);
|
||||||
ENumType GetNumType(const HWP_STRING& sValue);
|
ENumType GetNumType(HWP_STRING sValue);
|
||||||
|
|
||||||
class CCtrlAutoNumber : public CCtrl
|
class CCtrlAutoNumber : public CCtrl
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,8 +23,6 @@ namespace HWP
|
|||||||
|
|
||||||
EVertAlign GetVertAlign(HWP_STRING sValue)
|
EVertAlign GetVertAlign(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(CENTER, sValue, EVertAlign);
|
IF_STRING_IN_ENUM(CENTER, sValue, EVertAlign);
|
||||||
ELSE_IF_STRING_IN_ENUM(BOTTOM, sValue, EVertAlign);
|
ELSE_IF_STRING_IN_ENUM(BOTTOM, sValue, EVertAlign);
|
||||||
ELSE_IF_STRING_IN_ENUM(INSIDE, sValue, EVertAlign);
|
ELSE_IF_STRING_IN_ENUM(INSIDE, sValue, EVertAlign);
|
||||||
@ -44,8 +42,6 @@ namespace HWP
|
|||||||
|
|
||||||
EVRelTo GetVRelTo(HWP_STRING sValue)
|
EVRelTo GetVRelTo(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(PARA, sValue, EVRelTo);
|
IF_STRING_IN_ENUM(PARA, sValue, EVRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(PAGE, sValue, EVRelTo);
|
ELSE_IF_STRING_IN_ENUM(PAGE, sValue, EVRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(PAPER, sValue, EVRelTo);
|
ELSE_IF_STRING_IN_ENUM(PAPER, sValue, EVRelTo);
|
||||||
@ -65,8 +61,6 @@ namespace HWP
|
|||||||
|
|
||||||
EHRelTo GetHRelTo(HWP_STRING sValue)
|
EHRelTo GetHRelTo(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(PAGE, sValue, EHRelTo);
|
IF_STRING_IN_ENUM(PAGE, sValue, EHRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(PARA, sValue, EHRelTo);
|
ELSE_IF_STRING_IN_ENUM(PARA, sValue, EHRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(COLUMN, sValue, EHRelTo);
|
ELSE_IF_STRING_IN_ENUM(COLUMN, sValue, EHRelTo);
|
||||||
@ -87,8 +81,6 @@ namespace HWP
|
|||||||
|
|
||||||
EWidthRelTo GetWidthRelTo(HWP_STRING sValue)
|
EWidthRelTo GetWidthRelTo(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(PAGE, sValue, EWidthRelTo);
|
IF_STRING_IN_ENUM(PAGE, sValue, EWidthRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(PARA, sValue, EWidthRelTo);
|
ELSE_IF_STRING_IN_ENUM(PARA, sValue, EWidthRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(COLUMN, sValue, EWidthRelTo);
|
ELSE_IF_STRING_IN_ENUM(COLUMN, sValue, EWidthRelTo);
|
||||||
@ -108,8 +100,6 @@ namespace HWP
|
|||||||
|
|
||||||
EHeightRelTo GetHeightRelTo(HWP_STRING sValue)
|
EHeightRelTo GetHeightRelTo(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(PAGE, sValue, EHeightRelTo);
|
IF_STRING_IN_ENUM(PAGE, sValue, EHeightRelTo);
|
||||||
ELSE_IF_STRING_IN_ENUM(ABSOLUTE, sValue, EHeightRelTo);
|
ELSE_IF_STRING_IN_ENUM(ABSOLUTE, sValue, EHeightRelTo);
|
||||||
ELSE_STRING_IN_ENUM(PAPER, EHeightRelTo);
|
ELSE_STRING_IN_ENUM(PAPER, EHeightRelTo);
|
||||||
@ -129,8 +119,6 @@ namespace HWP
|
|||||||
|
|
||||||
EHorzAlign GetHorzAlign(HWP_STRING sValue)
|
EHorzAlign GetHorzAlign(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(CENTER, sValue, EHorzAlign);
|
IF_STRING_IN_ENUM(CENTER, sValue, EHorzAlign);
|
||||||
ELSE_IF_STRING_IN_ENUM(RIGHT, sValue, EHorzAlign);
|
ELSE_IF_STRING_IN_ENUM(RIGHT, sValue, EHorzAlign);
|
||||||
ELSE_IF_STRING_IN_ENUM(INSIDE, sValue, EHorzAlign);
|
ELSE_IF_STRING_IN_ENUM(INSIDE, sValue, EHorzAlign);
|
||||||
@ -151,8 +139,6 @@ namespace HWP
|
|||||||
|
|
||||||
ETextWrap GetTextWrap(HWP_STRING sValue)
|
ETextWrap GetTextWrap(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
TO_UPPER(sValue);
|
|
||||||
|
|
||||||
IF_STRING_IN_ENUM(TOP_AND_BOTTOM, sValue, ETextWrap);
|
IF_STRING_IN_ENUM(TOP_AND_BOTTOM, sValue, ETextWrap);
|
||||||
ELSE_IF_STRING_IN_ENUM(BEHIND_TEXT, sValue, ETextWrap);
|
ELSE_IF_STRING_IN_ENUM(BEHIND_TEXT, sValue, ETextWrap);
|
||||||
ELSE_IF_STRING_IN_ENUM(IN_FRONT_OF_TEXT, sValue, ETextWrap);
|
ELSE_IF_STRING_IN_ENUM(IN_FRONT_OF_TEXT, sValue, ETextWrap);
|
||||||
@ -268,7 +254,30 @@ namespace HWP
|
|||||||
}
|
}
|
||||||
|
|
||||||
CCtrlCommon::CCtrlCommon(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion, EHanType eType)
|
CCtrlCommon::CCtrlCommon(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion, EHanType eType)
|
||||||
: CCtrl(sCtrlID), m_bTreatAsChar(false), m_eVertRelTo(EVRelTo::PARA), m_eHorzRelTo(EHRelTo::PARA), m_nVertOffset(0), m_nHorzOffset(0), m_nWidth(0), m_nHeight(0), m_arOutMargin{0, 0, 0, 0}, m_arInMargin{0, 0, 0, 0}, m_eTextVerAlign(EVertAlign::TOP)
|
: CCtrl(sCtrlID), m_bTreatAsChar(false), m_eVertRelTo(EVRelTo::PARA), m_eHorzRelTo(EHRelTo::PARA),
|
||||||
|
m_nVertOffset(0), m_nHorzOffset(0), m_nWidth(0), m_nHeight(0), m_arOutMargin{0, 0, 0, 0},
|
||||||
|
m_arInMargin{0, 0, 0, 0}, m_eTextVerAlign(EVertAlign::TOP), m_nZOrder(0)
|
||||||
|
{
|
||||||
|
if (EHanType::HWPX == eType)
|
||||||
|
ReadAttributes(oReader, eType);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCtrlCommon::~CCtrlCommon()
|
||||||
|
{
|
||||||
|
for (CHWPPargraph* pParagraph : m_arParas)
|
||||||
|
{
|
||||||
|
if (0 == pParagraph->Release())
|
||||||
|
pParagraph = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CCapParagraph* pCapParagraph : m_arCaption)
|
||||||
|
{
|
||||||
|
if (0 == pCapParagraph->Release())
|
||||||
|
pCapParagraph = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCtrlCommon::ReadAttributes(CXMLReader &oReader, EHanType eType)
|
||||||
{
|
{
|
||||||
std::string sType;
|
std::string sType;
|
||||||
|
|
||||||
@ -321,21 +330,6 @@ namespace HWP
|
|||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
}
|
}
|
||||||
|
|
||||||
CCtrlCommon::~CCtrlCommon()
|
|
||||||
{
|
|
||||||
for (CHWPPargraph* pParagraph : m_arParas)
|
|
||||||
{
|
|
||||||
if (0 == pParagraph->Release())
|
|
||||||
pParagraph = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CCapParagraph* pCapParagraph : m_arCaption)
|
|
||||||
{
|
|
||||||
if (0 == pCapParagraph->Release())
|
|
||||||
pCapParagraph = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ECtrlObjectType CCtrlCommon::GetCtrlType() const
|
ECtrlObjectType CCtrlCommon::GetCtrlType() const
|
||||||
{
|
{
|
||||||
return ECtrlObjectType::Common;
|
return ECtrlObjectType::Common;
|
||||||
@ -350,6 +344,17 @@ namespace HWP
|
|||||||
{
|
{
|
||||||
const std::string sNodeName{oReader.GetName()};
|
const std::string sNodeName{oReader.GetName()};
|
||||||
|
|
||||||
|
if (EHanType::HWPML == eType && "SHAPEOBJECT" == sNodeName)
|
||||||
|
{
|
||||||
|
ReadAttributes(oReader, eType);
|
||||||
|
|
||||||
|
WHILE_READ_NEXT_NODE(oReader)
|
||||||
|
ParseChildren(oReader, nVersion, EHanType::HWPML);
|
||||||
|
END_WHILE
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetNodeName(ENode::Size, eType) == sNodeName)
|
if (GetNodeName(ENode::Size, eType) == sNodeName)
|
||||||
{
|
{
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
|
|||||||
@ -109,6 +109,8 @@ class CCtrlCommon : public CCtrl
|
|||||||
friend class CCtrlShapeVideo;
|
friend class CCtrlShapeVideo;
|
||||||
friend class CCtrlEqEdit;
|
friend class CCtrlEqEdit;
|
||||||
friend class CCtrlTable;
|
friend class CCtrlTable;
|
||||||
|
|
||||||
|
void ReadAttributes(CXMLReader& oReader, EHanType eType);
|
||||||
public:
|
public:
|
||||||
CCtrlCommon();
|
CCtrlCommon();
|
||||||
CCtrlCommon(const HWP_STRING& sCtrlID);
|
CCtrlCommon(const HWP_STRING& sCtrlID);
|
||||||
|
|||||||
@ -88,6 +88,9 @@ EShapeType CCtrlGeneralShape::GetShapeType() const
|
|||||||
|
|
||||||
ELineArrowSize CheckLineSize(const std::string& sLineSzType, EHanType eType)
|
ELineArrowSize CheckLineSize(const std::string& sLineSzType, EHanType eType)
|
||||||
{
|
{
|
||||||
|
if (sLineSzType.empty())
|
||||||
|
return ELineArrowSize::MEDIUM_MEDIUM;
|
||||||
|
|
||||||
if (GetValueName(EValue::SmallSmall, eType) == sLineSzType)
|
if (GetValueName(EValue::SmallSmall, eType) == sLineSzType)
|
||||||
return ELineArrowSize::SMALL_SMALL;
|
return ELineArrowSize::SMALL_SMALL;
|
||||||
else if (GetValueName(EValue::SmallMedium, eType) == sLineSzType)
|
else if (GetValueName(EValue::SmallMedium, eType) == sLineSzType)
|
||||||
@ -112,6 +115,9 @@ ELineArrowSize CheckLineSize(const std::string& sLineSzType, EHanType eType)
|
|||||||
|
|
||||||
ELineArrowStyle CheckLineArrowStyle(const std::string& sLineArrowStyle, bool bHeadFill, EHanType eType)
|
ELineArrowStyle CheckLineArrowStyle(const std::string& sLineArrowStyle, bool bHeadFill, EHanType eType)
|
||||||
{
|
{
|
||||||
|
if (sLineArrowStyle.empty())
|
||||||
|
return ELineArrowStyle::NORMAL;
|
||||||
|
|
||||||
if (GetValueName(EValue::Arrow, eType) == sLineArrowStyle)
|
if (GetValueName(EValue::Arrow, eType) == sLineArrowStyle)
|
||||||
return ELineArrowStyle::ARROW;
|
return ELineArrowStyle::ARROW;
|
||||||
else if (GetValueName(EValue::Spear, eType) == sLineArrowStyle)
|
else if (GetValueName(EValue::Spear, eType) == sLineArrowStyle)
|
||||||
@ -136,7 +142,7 @@ ELineArrowStyle CheckLineArrowStyle(const std::string& sLineArrowStyle, bool bHe
|
|||||||
{
|
{
|
||||||
if (EHanType::HWPX == eType)
|
if (EHanType::HWPX == eType)
|
||||||
return bHeadFill ? ELineArrowStyle::BOX : ELineArrowStyle::EMPTY_BOX;
|
return bHeadFill ? ELineArrowStyle::BOX : ELineArrowStyle::EMPTY_BOX;
|
||||||
|
|
||||||
return ELineArrowStyle::EMPTY_BOX;
|
return ELineArrowStyle::EMPTY_BOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,30 +185,30 @@ void CCtrlGeneralShape::ParseChildren(CXMLReader& oReader, int nVersion, EHanTyp
|
|||||||
m_eLineHead = CheckLineArrowStyle(sHeadStyle, bHeadFill, eType);
|
m_eLineHead = CheckLineArrowStyle(sHeadStyle, bHeadFill, eType);
|
||||||
m_eLineTail = CheckLineArrowStyle(sTailStyle, bTailFill, eType);
|
m_eLineTail = CheckLineArrowStyle(sTailStyle, bTailFill, eType);
|
||||||
}
|
}
|
||||||
else if ("hc:fillBrush" == sNodeName)
|
else if (GetNodeName(ENode::FillBrush, eType) == sNodeName)
|
||||||
m_pFill = new CFill(oReader, eType);
|
m_pFill = new CFill(oReader, eType);
|
||||||
else if ("hp:drawText" == sNodeName)
|
else if (GetNodeName(ENode::DrawText, eType) == sNodeName)
|
||||||
{
|
{
|
||||||
m_nMaxTxtWidth = oReader.GetAttributeInt("lastWidth");
|
m_nMaxTxtWidth = oReader.GetAttributeInt(GetAttributeName(EAttribute::LastWidth, eType));
|
||||||
|
|
||||||
WHILE_READ_NEXT_NODE_WITH_DEPTH_AND_NAME(oReader, Child)
|
WHILE_READ_NEXT_NODE_WITH_DEPTH_AND_NAME(oReader, Child)
|
||||||
{
|
{
|
||||||
if ("hp:textMargin" == sNodeChildName)
|
if (GetNodeName(ENode::TextMargin, eType) == sNodeChildName)
|
||||||
{
|
{
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
{
|
{
|
||||||
if ("left" == sAttributeName)
|
if (GetAttributeName(EAttribute::Left, eType) == sAttributeName)
|
||||||
m_shLeftSpace = oReader.GetInt();
|
m_shLeftSpace = oReader.GetInt();
|
||||||
else if ("right" == sAttributeName)
|
else if (GetAttributeName(EAttribute::Right, eType) == sAttributeName)
|
||||||
m_shRightSpace = oReader.GetInt();
|
m_shRightSpace = oReader.GetInt();
|
||||||
else if ("top" == sAttributeName)
|
else if (GetAttributeName(EAttribute::Top, eType) == sAttributeName)
|
||||||
m_shTopSpace = oReader.GetInt();
|
m_shTopSpace = oReader.GetInt();
|
||||||
else if ("bottom" == sAttributeName)
|
else if (GetAttributeName(EAttribute::Bottom, eType) == sAttributeName)
|
||||||
m_shBottomSpace = oReader.GetInt();
|
m_shBottomSpace = oReader.GetInt();
|
||||||
}
|
}
|
||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
}
|
}
|
||||||
else if ("hp:subList" == sNodeChildName)
|
else if (EHanType::HWPX == eType && "hp:subList" == sNodeChildName)
|
||||||
ReadSubList(oReader, nVersion);
|
ReadSubList(oReader, nVersion);
|
||||||
}
|
}
|
||||||
END_WHILE
|
END_WHILE
|
||||||
|
|||||||
@ -24,11 +24,22 @@ CCtrlHeadFoot::CCtrlHeadFoot(const HWP_STRING& sCtrlID, int nSize, CHWPStream& o
|
|||||||
oBuffer.ReadInt(m_nSerialInSec);
|
oBuffer.ReadInt(m_nSerialInSec);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCtrlHeadFoot::CCtrlHeadFoot(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion)
|
CCtrlHeadFoot::CCtrlHeadFoot(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion, EHanType eType)
|
||||||
: CCtrl(sCtrlID)
|
: CCtrl(sCtrlID)
|
||||||
{
|
{
|
||||||
m_bIsHeader = L"daeh" == sCtrlID;
|
m_bIsHeader = L"daeh" == sCtrlID;
|
||||||
|
|
||||||
|
switch (eType)
|
||||||
|
{
|
||||||
|
case EHanType::HWPX: ReadFromHWPX(oReader, nVersion); break;
|
||||||
|
case EHanType::HWPML:ReadFromHWPML(oReader); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bFullFilled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCtrlHeadFoot::ReadFromHWPX(CXMLReader &oReader, int nVersion)
|
||||||
|
{
|
||||||
m_eWhichPage = GetPageRange(oReader.GetAttributeInt("applyPageType"));
|
m_eWhichPage = GetPageRange(oReader.GetAttributeInt("applyPageType"));
|
||||||
|
|
||||||
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hp:subList")
|
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hp:subList")
|
||||||
@ -51,8 +62,36 @@ CCtrlHeadFoot::CCtrlHeadFoot(const HWP_STRING& sCtrlID, CXMLReader& oReader, int
|
|||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
END_WHILE
|
END_WHILE
|
||||||
|
}
|
||||||
|
|
||||||
m_bFullFilled = true;
|
void CCtrlHeadFoot::ReadFromHWPML(CXMLReader &oReader)
|
||||||
|
{
|
||||||
|
START_READ_ATTRIBUTES(oReader)
|
||||||
|
{
|
||||||
|
if ("ApplyPageType" == sAttributeName)
|
||||||
|
{
|
||||||
|
const std::string sValue{oReader.GetTextA()};
|
||||||
|
|
||||||
|
if ("Both" == sValue)
|
||||||
|
m_eWhichPage = EPageRange::BOTH;
|
||||||
|
else if ("Even" == sValue)
|
||||||
|
m_eWhichPage = EPageRange::EVEN;
|
||||||
|
else if ("Odd" == sValue)
|
||||||
|
m_eWhichPage = EPageRange::ODD;
|
||||||
|
}
|
||||||
|
else if ("TextHeight" == sAttributeName)
|
||||||
|
m_nTextHeight = oReader.GetInt();
|
||||||
|
else if ("TextWidth" == sAttributeName)
|
||||||
|
m_nTextWidth = oReader.GetInt();
|
||||||
|
//TODO:: Реализовать HasTextRef и HasTextRef
|
||||||
|
}
|
||||||
|
END_READ_ATTRIBUTES(oReader)
|
||||||
|
|
||||||
|
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "PARALIST")
|
||||||
|
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Child, "P")
|
||||||
|
m_arParas.push_back(new CHWPPargraph(oReader, 0, EHanType::HWPML));
|
||||||
|
END_WHILE
|
||||||
|
END_WHILE
|
||||||
}
|
}
|
||||||
|
|
||||||
ECtrlObjectType CCtrlHeadFoot::GetCtrlType() const
|
ECtrlObjectType CCtrlHeadFoot::GetCtrlType() const
|
||||||
|
|||||||
@ -28,10 +28,13 @@ class CCtrlHeadFoot : public CCtrl
|
|||||||
HWP_BYTE m_chRefLevelNum;
|
HWP_BYTE m_chRefLevelNum;
|
||||||
|
|
||||||
VECTOR<CHWPPargraph*> m_arParas;
|
VECTOR<CHWPPargraph*> m_arParas;
|
||||||
|
|
||||||
|
void ReadFromHWPX(CXMLReader& oReader, int nVersion);
|
||||||
|
void ReadFromHWPML(CXMLReader& oReader);
|
||||||
public:
|
public:
|
||||||
CCtrlHeadFoot(const HWP_STRING& sCtrlID);
|
CCtrlHeadFoot(const HWP_STRING& sCtrlID);
|
||||||
CCtrlHeadFoot(const HWP_STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion, bool bIsHeader);
|
CCtrlHeadFoot(const HWP_STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion, bool bIsHeader);
|
||||||
CCtrlHeadFoot(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion);
|
CCtrlHeadFoot(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion, EHanType eType);
|
||||||
|
|
||||||
ECtrlObjectType GetCtrlType() const override;
|
ECtrlObjectType GetCtrlType() const override;
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ TMatrix ReadMatrix(CXMLReader& oReader, EHanType eType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CCtrlObjElement::CCtrlObjElement(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion, EHanType eType)
|
CCtrlObjElement::CCtrlObjElement(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVersion, EHanType eType)
|
||||||
: CCtrlCommon(sCtrlID, oReader, nVersion, eType)
|
: CCtrlCommon(sCtrlID, oReader, nVersion, eType), m_nCurWidth(0), m_nCurHeight(0)
|
||||||
{
|
{
|
||||||
if (EHanType::HWPX == eType)
|
if (EHanType::HWPX == eType)
|
||||||
m_shNGrp = oReader.GetAttributeInt("groupLevel");
|
m_shNGrp = oReader.GetAttributeInt("groupLevel");
|
||||||
|
|||||||
@ -20,7 +20,7 @@ ENumPos GetNumPos(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ENumPos GetNumPos(const HWP_STRING& sValue)
|
ENumPos GetNumPos(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(TOP_LEFT, sValue, ENumPos);
|
IF_STRING_IN_ENUM(TOP_LEFT, sValue, ENumPos);
|
||||||
ELSE_IF_STRING_IN_ENUM(TOP_CENTER, sValue, ENumPos);
|
ELSE_IF_STRING_IN_ENUM(TOP_CENTER, sValue, ENumPos);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ EArcType GetArcType(int nValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EArcType GetArcType(const HWP_STRING& sValue)
|
EArcType GetArcType(HWP_STRING sValue)
|
||||||
{
|
{
|
||||||
IF_STRING_IN_ENUM(PIE, sValue, EArcType);
|
IF_STRING_IN_ENUM(PIE, sValue, EArcType);
|
||||||
ELSE_IF_STRING_IN_ENUM(CHORD, sValue, EArcType);
|
ELSE_IF_STRING_IN_ENUM(CHORD, sValue, EArcType);
|
||||||
|
|||||||
@ -13,7 +13,7 @@ enum class EArcType
|
|||||||
};
|
};
|
||||||
|
|
||||||
EArcType GetArcType(int nValue);
|
EArcType GetArcType(int nValue);
|
||||||
EArcType GetArcType(const HWP_STRING& sValue);
|
EArcType GetArcType(HWP_STRING sValue);
|
||||||
|
|
||||||
class CCtrlShapeEllipse : public CCtrlGeneralShape
|
class CCtrlShapeEllipse : public CCtrlGeneralShape
|
||||||
{
|
{
|
||||||
|
|||||||
@ -354,29 +354,7 @@ void CCtrlShapePic::ReadFromHWPX(CXMLReader &oReader, int nVersion)
|
|||||||
else if ("hp:effects" == sNodeName)
|
else if ("hp:effects" == sNodeName)
|
||||||
ReadEffects(oReader, EHanType::HWPX);
|
ReadEffects(oReader, EHanType::HWPX);
|
||||||
else if ("hc:img" == sNodeName)
|
else if ("hc:img" == sNodeName)
|
||||||
{
|
ReadImage(oReader, EHanType::HWPX);
|
||||||
START_READ_ATTRIBUTES(oReader)
|
|
||||||
{
|
|
||||||
if ("bright" == sAttributeName)
|
|
||||||
m_chBright = (HWP_BYTE)oReader.GetInt();
|
|
||||||
else if ("contrast" == sAttributeName)
|
|
||||||
m_chContrast = (HWP_BYTE)oReader.GetInt();
|
|
||||||
else if ("effect" == sAttributeName)
|
|
||||||
{
|
|
||||||
const std::string sType{oReader.GetTextA()};
|
|
||||||
|
|
||||||
if ("REAL_PIC" == sType)
|
|
||||||
m_chEffect = 0;
|
|
||||||
else if ("GRAY_SCALE" == sType)
|
|
||||||
m_chEffect = 1;
|
|
||||||
else if ("BLACK_WHITE" == sType)
|
|
||||||
m_chEffect = 2;
|
|
||||||
}
|
|
||||||
else if ("binaryItemIDRef" == sAttributeName)
|
|
||||||
m_sBinDataID = oReader.GetText();
|
|
||||||
}
|
|
||||||
END_READ_ATTRIBUTES(oReader)
|
|
||||||
}
|
|
||||||
else if ("hp:imgDim" == sNodeName)
|
else if ("hp:imgDim" == sNodeName)
|
||||||
{
|
{
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
@ -419,6 +397,10 @@ void CCtrlShapePic::ReadFromHWPML(CXMLReader &oReader)
|
|||||||
ReadImageClip(oReader, EHanType::HWPML);
|
ReadImageClip(oReader, EHanType::HWPML);
|
||||||
else if ("EFFECTS" == sNodeName)
|
else if ("EFFECTS" == sNodeName)
|
||||||
ReadEffects(oReader, EHanType::HWPML);
|
ReadEffects(oReader, EHanType::HWPML);
|
||||||
|
else if ("IMAGE" == sNodeName)
|
||||||
|
ReadImage(oReader, EHanType::HWPML);
|
||||||
|
else
|
||||||
|
CCtrlGeneralShape::ParseChildren(oReader, 0, EHanType::HWPML);
|
||||||
}
|
}
|
||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
@ -455,6 +437,31 @@ void CCtrlShapePic::ReadEffects(CXMLReader &oReader, EHanType eType)
|
|||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCtrlShapePic::ReadImage(CXMLReader &oReader, EHanType eType)
|
||||||
|
{
|
||||||
|
START_READ_ATTRIBUTES(oReader)
|
||||||
|
{
|
||||||
|
if (GetAttributeName(EAttribute::Bright, eType) == sAttributeName)
|
||||||
|
m_chBright = (HWP_BYTE)oReader.GetInt();
|
||||||
|
else if (GetAttributeName(EAttribute::Contrast, eType) == sAttributeName)
|
||||||
|
m_chContrast = (HWP_BYTE)oReader.GetInt();
|
||||||
|
else if (GetAttributeName(EAttribute::Effect, eType) == sAttributeName)
|
||||||
|
{
|
||||||
|
const std::string sType{oReader.GetTextA()};
|
||||||
|
|
||||||
|
if (GetValueName(EValue::RealPic, eType) == sType)
|
||||||
|
m_chEffect = 0;
|
||||||
|
else if (GetValueName(EValue::GrayScale, eType) == sType)
|
||||||
|
m_chEffect = 1;
|
||||||
|
else if (GetValueName(EValue::BlackWhite, eType) == sType)
|
||||||
|
m_chEffect = 2;
|
||||||
|
}
|
||||||
|
else if (GetAttributeName(EAttribute::BinItem, eType) == sAttributeName)
|
||||||
|
m_sBinDataID = oReader.GetText();
|
||||||
|
}
|
||||||
|
END_READ_ATTRIBUTES(oReader)
|
||||||
|
}
|
||||||
|
|
||||||
EShapeType CCtrlShapePic::GetShapeType() const
|
EShapeType CCtrlShapePic::GetShapeType() const
|
||||||
{
|
{
|
||||||
return EShapeType::Pic;
|
return EShapeType::Pic;
|
||||||
|
|||||||
@ -135,6 +135,7 @@ class CCtrlShapePic : public CCtrlGeneralShape
|
|||||||
|
|
||||||
void ReadImageClip(CXMLReader& oReader, EHanType eType);
|
void ReadImageClip(CXMLReader& oReader, EHanType eType);
|
||||||
void ReadEffects(CXMLReader& oReader, EHanType eType);
|
void ReadEffects(CXMLReader& oReader, EHanType eType);
|
||||||
|
void ReadImage(CXMLReader& oReader, EHanType eType);
|
||||||
public:
|
public:
|
||||||
CCtrlShapePic();
|
CCtrlShapePic();
|
||||||
CCtrlShapePic(const HWP_STRING& sCtrlID);
|
CCtrlShapePic(const HWP_STRING& sCtrlID);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "CtrlTable.h"
|
#include "CtrlTable.h"
|
||||||
|
|
||||||
|
#include "../Common/NodeNames.h"
|
||||||
|
|
||||||
namespace HWP
|
namespace HWP
|
||||||
{
|
{
|
||||||
CCtrlTable::CCtrlTable(const HWP_STRING& sCtrlID)
|
CCtrlTable::CCtrlTable(const HWP_STRING& sCtrlID)
|
||||||
@ -15,51 +17,51 @@ CCtrlTable::CCtrlTable(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVers
|
|||||||
{
|
{
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
{
|
{
|
||||||
if ("rowCnt" == sAttributeName)
|
if (GetAttributeName(EAttribute::RowCount, eType) == sAttributeName)
|
||||||
m_shNRows = oReader.GetInt();
|
m_shNRows = oReader.GetInt();
|
||||||
else if ("colCnt" == sAttributeName)
|
else if (GetAttributeName(EAttribute::ColCount, eType) == sAttributeName)
|
||||||
m_shNCols = oReader.GetInt();
|
m_shNCols = oReader.GetInt();
|
||||||
else if ("cellSpacing" == sAttributeName)
|
else if (GetAttributeName(EAttribute::CellSpacing, eType) == sAttributeName)
|
||||||
m_shCellSpacing = oReader.GetInt();
|
m_shCellSpacing = oReader.GetInt();
|
||||||
else if ("borderFillIDRef" == sAttributeName)
|
else if (GetAttributeName(EAttribute::BorderFill, eType) == sAttributeName)
|
||||||
m_shBorderFillID = oReader.GetInt();
|
m_shBorderFillID = oReader.GetInt();
|
||||||
}
|
}
|
||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
|
|
||||||
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
|
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
|
||||||
{
|
{
|
||||||
if ("hp:inMargin" == sNodeName)
|
if (GetNodeName(ENode::InSideMargin, eType) == sNodeName)
|
||||||
{
|
{
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
{
|
{
|
||||||
if ("left" == sAttributeName)
|
if (GetAttributeName(EAttribute::Left, eType) == sAttributeName)
|
||||||
m_shInLSpace = oReader.GetInt();
|
m_shInLSpace = oReader.GetInt();
|
||||||
else if ("right" == sAttributeName)
|
else if (GetAttributeName(EAttribute::Right, eType) == sAttributeName)
|
||||||
m_shInRSpace = oReader.GetInt();
|
m_shInRSpace = oReader.GetInt();
|
||||||
else if ("top" == sAttributeName)
|
else if (GetAttributeName(EAttribute::Top, eType) == sAttributeName)
|
||||||
m_shInTSpace = oReader.GetInt();
|
m_shInTSpace = oReader.GetInt();
|
||||||
else if ("bottom" == sAttributeName)
|
else if (GetAttributeName(EAttribute::Bottom, eType) == sAttributeName)
|
||||||
m_shInBSpace = oReader.GetInt();
|
m_shInBSpace = oReader.GetInt();
|
||||||
}
|
}
|
||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
}
|
}
|
||||||
else if ("hp:cellzoneList" == sNodeName)
|
else if (GetNodeName(ENode::CellZoneList, eType) == sNodeName)
|
||||||
{
|
{
|
||||||
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Child, "hp:cellzone")
|
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Child, GetNodeName(ENode::CellZone, eType))
|
||||||
{
|
{
|
||||||
TCellZone* pCellZone = new TCellZone();
|
TCellZone* pCellZone = new TCellZone();
|
||||||
|
|
||||||
START_READ_ATTRIBUTES(oReader)
|
START_READ_ATTRIBUTES(oReader)
|
||||||
{
|
{
|
||||||
if ("startRowAddr" == sAttributeName)
|
if (GetAttributeName(EAttribute::StartRowAddr, eType) == sAttributeName)
|
||||||
pCellZone->m_shStartRowAddr = oReader.GetInt();
|
pCellZone->m_shStartRowAddr = oReader.GetInt();
|
||||||
else if ("startColAddr" == sAttributeName)
|
else if (GetAttributeName(EAttribute::StartColAddr, eType) == sAttributeName)
|
||||||
pCellZone->m_shStartColAddr = oReader.GetInt();
|
pCellZone->m_shStartColAddr = oReader.GetInt();
|
||||||
else if ("endRowAddr" == sAttributeName)
|
else if (GetAttributeName(EAttribute::EndRowAddr, eType) == sAttributeName)
|
||||||
pCellZone->m_shEndRowAddr = oReader.GetInt();
|
pCellZone->m_shEndRowAddr = oReader.GetInt();
|
||||||
else if ("endColAddr" == sAttributeName)
|
else if (GetAttributeName(EAttribute::EndColAddr, eType) == sAttributeName)
|
||||||
pCellZone->m_shEndColAddr = oReader.GetInt();
|
pCellZone->m_shEndColAddr = oReader.GetInt();
|
||||||
else if ("borderFillIDRef" == sAttributeName)
|
else if (GetAttributeName(EAttribute::BorderFill, eType) == sAttributeName)
|
||||||
pCellZone->m_shBorderFillIDRef = oReader.GetInt();
|
pCellZone->m_shBorderFillIDRef = oReader.GetInt();
|
||||||
}
|
}
|
||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
@ -68,10 +70,10 @@ CCtrlTable::CCtrlTable(const HWP_STRING& sCtrlID, CXMLReader& oReader, int nVers
|
|||||||
}
|
}
|
||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
else if ("hp:tr" == sNodeName)
|
else if (GetNodeName(ENode::Row, eType) == sNodeName)
|
||||||
{
|
{
|
||||||
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Child, "hp:tc")
|
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Child, GetNodeName(ENode::Cell, eType))
|
||||||
m_arCells.push_back(new CTblCell(oReader, nVersion));
|
m_arCells.push_back(new CTblCell(oReader, nVersion, eType));
|
||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace HWP
|
|||||||
struct TCellZone
|
struct TCellZone
|
||||||
{
|
{
|
||||||
short m_shStartRowAddr;
|
short m_shStartRowAddr;
|
||||||
short m_shStartColAddr;;
|
short m_shStartColAddr;
|
||||||
short m_shEndRowAddr;
|
short m_shEndRowAddr;
|
||||||
short m_shEndColAddr;
|
short m_shEndColAddr;
|
||||||
short m_shBorderFillIDRef;
|
short m_shBorderFillIDRef;
|
||||||
|
|||||||
@ -45,7 +45,7 @@ CHWPPargraph::CHWPPargraph(CXMLReader& oReader, int nVersion, EHanType eType)
|
|||||||
else
|
else
|
||||||
m_chBreakType &= 0b11111011;
|
m_chBreakType &= 0b11111011;
|
||||||
}
|
}
|
||||||
else if (GetAttributeName(EAttribute::ColumnBreak, eType) == sAttributeName)
|
else if (Equals(EAttribute::ColumnBreak, eType, sAttributeName))
|
||||||
{
|
{
|
||||||
if (oReader.GetBool())
|
if (oReader.GetBool())
|
||||||
m_chBreakType |= 0b00001000;
|
m_chBreakType |= 0b00001000;
|
||||||
@ -97,12 +97,6 @@ bool CHWPPargraph::ParseHWPParagraph(CXMLReader& oReader, int nCharShapeID, int
|
|||||||
|
|
||||||
if (GetNodeName(ENode::SectionDef, eType) == sNodeName)
|
if (GetNodeName(ENode::SectionDef, eType) == sNodeName)
|
||||||
m_arP.push_back(new CCtrlSectionDef(L"dces", oReader, nVersion));
|
m_arP.push_back(new CCtrlSectionDef(L"dces", oReader, nVersion));
|
||||||
else if (GetNodeName(ENode::Ctrl, eType) == sNodeName)
|
|
||||||
{
|
|
||||||
WHILE_READ_NEXT_NODE(oReader)
|
|
||||||
AddCtrl(CCtrl::GetCtrl(oReader, nVersion));
|
|
||||||
END_WHILE
|
|
||||||
}
|
|
||||||
else if (GetNodeName(ENode::Char, eType) == sNodeName)
|
else if (GetNodeName(ENode::Char, eType) == sNodeName)
|
||||||
{
|
{
|
||||||
if (oReader.IsEmptyNode())
|
if (oReader.IsEmptyNode())
|
||||||
@ -170,6 +164,14 @@ bool CHWPPargraph::ParseHWPParagraph(CXMLReader& oReader, int nCharShapeID, int
|
|||||||
m_arP.push_back(new CCtrlShapeTextArt(L"tat$", oReader, nVersion, eType));
|
m_arP.push_back(new CCtrlShapeTextArt(L"tat$", oReader, nVersion, eType));
|
||||||
else if (GetNodeName(ENode::Video, eType) == sNodeName)
|
else if (GetNodeName(ENode::Video, eType) == sNodeName)
|
||||||
m_arP.push_back(new CCtrlShapeVideo(L"div$", oReader, nVersion, eType));
|
m_arP.push_back(new CCtrlShapeVideo(L"div$", oReader, nVersion, eType));
|
||||||
|
else if (EHanType::HWPX == eType && "hp:ctrl" == sNodeName)
|
||||||
|
{
|
||||||
|
WHILE_READ_NEXT_NODE(oReader)
|
||||||
|
AddCtrl(CCtrl::GetCtrl(oReader, nVersion, EHanType::HWPX));
|
||||||
|
END_WHILE
|
||||||
|
}
|
||||||
|
else if (EHanType::HWPML == eType)
|
||||||
|
AddCtrl(CCtrl::GetCtrl(oReader, nVersion, EHanType::HWPML));
|
||||||
|
|
||||||
if (unCurrentParaCount != m_arP.size())
|
if (unCurrentParaCount != m_arP.size())
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#include "TblCell.h"
|
#include "TblCell.h"
|
||||||
#include "CtrlCharacter.h"
|
#include "CtrlCharacter.h"
|
||||||
|
|
||||||
|
#include "../Common/NodeNames.h"
|
||||||
|
|
||||||
namespace HWP
|
namespace HWP
|
||||||
{
|
{
|
||||||
CTblCell::CTblCell(int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
|
CTblCell::CTblCell(int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
|
||||||
@ -25,7 +27,16 @@ CTblCell::CTblCell(int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
|
|||||||
oBuffer.Skip(nSize - oBuffer.GetDistanceToLastPos(true));
|
oBuffer.Skip(nSize - oBuffer.GetDistanceToLastPos(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
CTblCell::CTblCell(CXMLReader& oReader, int nVersion)
|
CTblCell::CTblCell(CXMLReader& oReader, int nVersion, EHanType eType)
|
||||||
|
{
|
||||||
|
switch (eType)
|
||||||
|
{
|
||||||
|
case EHanType::HWPX: ReadFromHWPX(oReader, nVersion); return;
|
||||||
|
case EHanType::HWPML: ReadFromHWPML(oReader); return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTblCell::ReadFromHWPX(CXMLReader &oReader, int nVersion)
|
||||||
{
|
{
|
||||||
m_shBorderFill = oReader.GetAttributeInt("borderFillIDRef");
|
m_shBorderFill = oReader.GetAttributeInt("borderFillIDRef");
|
||||||
|
|
||||||
@ -65,42 +76,87 @@ CTblCell::CTblCell(CXMLReader& oReader, int nVersion)
|
|||||||
END_READ_ATTRIBUTES(oReader)
|
END_READ_ATTRIBUTES(oReader)
|
||||||
}
|
}
|
||||||
else if ("hp:cellSz" == sNodeName)
|
else if ("hp:cellSz" == sNodeName)
|
||||||
{
|
ReadCellMargin(oReader, EHanType::HWPX);
|
||||||
START_READ_ATTRIBUTES(oReader)
|
|
||||||
{
|
|
||||||
if ("left" == sAttributeName)
|
|
||||||
m_arMargin[0] = oReader.GetInt();
|
|
||||||
else if ("right" == sAttributeName)
|
|
||||||
m_arMargin[1] = oReader.GetInt();
|
|
||||||
else if ("top" == sAttributeName)
|
|
||||||
m_arMargin[2] = oReader.GetInt();
|
|
||||||
else if ("bottom" == sAttributeName)
|
|
||||||
m_arMargin[3] = oReader.GetInt();
|
|
||||||
}
|
|
||||||
END_READ_ATTRIBUTES(oReader)
|
|
||||||
}
|
|
||||||
else if ("hp:subList" == sNodeName)
|
else if ("hp:subList" == sNodeName)
|
||||||
{
|
{
|
||||||
m_eVertAlign = ::HWP::GetVertAlign(oReader.GetAttribute("vertAlign"));
|
m_eVertAlign = ::HWP::GetVertAlign(oReader.GetAttribute("vertAlign"));
|
||||||
|
|
||||||
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hp:p")
|
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hp:p")
|
||||||
{
|
ReadCell(oReader, nVersion, EHanType::HWPX);
|
||||||
CCellParagraph *pCellParagraphs = new CCellParagraph(oReader, nVersion);
|
|
||||||
|
|
||||||
if (nullptr == pCellParagraphs)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ECtrlObjectType::Character != pCellParagraphs->GetCtrls().back()->GetCtrlType())
|
|
||||||
pCellParagraphs->AddCtrl(new CCtrlCharacter(L" _", ECtrlCharType::PARAGRAPH_BREAK));
|
|
||||||
|
|
||||||
m_arParas.push_back(pCellParagraphs);
|
|
||||||
}
|
|
||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_WHILE
|
END_WHILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTblCell::ReadFromHWPML(CXMLReader &oReader)
|
||||||
|
{
|
||||||
|
START_READ_ATTRIBUTES(oReader)
|
||||||
|
{
|
||||||
|
if ("Name" == sAttributeName)
|
||||||
|
m_sMergedColName = oReader.GetText();
|
||||||
|
else if ("ColAddr" == sAttributeName)
|
||||||
|
m_shColAddr = oReader.GetInt();
|
||||||
|
else if ("RowAddr" == sAttributeName)
|
||||||
|
m_shRowAddr = oReader.GetInt();
|
||||||
|
else if ("ColSpan" == sAttributeName)
|
||||||
|
m_shColSpan = oReader.GetInt();
|
||||||
|
else if ("RowSpan" == sAttributeName)
|
||||||
|
m_shRowSpan = oReader.GetInt();
|
||||||
|
else if ("Width" == sAttributeName)
|
||||||
|
m_nWidth = oReader.GetInt();
|
||||||
|
else if ("Height" == sAttributeName)
|
||||||
|
m_nHeight = oReader.GetInt();
|
||||||
|
else if ("BorderFill" == sAttributeName)
|
||||||
|
m_shBorderFill = oReader.GetInt();
|
||||||
|
}
|
||||||
|
END_READ_ATTRIBUTES(oReader)
|
||||||
|
|
||||||
|
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
|
||||||
|
{
|
||||||
|
if ("CELLMARGIN" == sNodeName)
|
||||||
|
ReadCellMargin(oReader, EHanType::HWPML);
|
||||||
|
else if ("PARALIST" == sNodeName)
|
||||||
|
{
|
||||||
|
m_eVertAlign = ::HWP::GetVertAlign(oReader.GetAttribute("VertAlign"));
|
||||||
|
|
||||||
|
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "P")
|
||||||
|
ReadCell(oReader, 0, EHanType::HWPML);
|
||||||
|
END_WHILE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END_WHILE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTblCell::ReadCellMargin(CXMLReader &oReader, EHanType eType)
|
||||||
|
{
|
||||||
|
START_READ_ATTRIBUTES(oReader)
|
||||||
|
{
|
||||||
|
if (GetAttributeName(EAttribute::Left, eType) == sAttributeName)
|
||||||
|
m_arMargin[0] = oReader.GetInt();
|
||||||
|
else if (GetAttributeName(EAttribute::Right, eType) == sAttributeName)
|
||||||
|
m_arMargin[1] = oReader.GetInt();
|
||||||
|
else if (GetAttributeName(EAttribute::Top, eType) == sAttributeName)
|
||||||
|
m_arMargin[2] = oReader.GetInt();
|
||||||
|
else if (GetAttributeName(EAttribute::Bottom, eType) == sAttributeName)
|
||||||
|
m_arMargin[3] = oReader.GetInt();
|
||||||
|
}
|
||||||
|
END_READ_ATTRIBUTES(oReader)
|
||||||
|
}
|
||||||
|
|
||||||
|
void HWP::CTblCell::ReadCell(CXMLReader &oReader, int nVersion, EHanType eType)
|
||||||
|
{
|
||||||
|
CCellParagraph *pCellParagraphs = new CCellParagraph(oReader, nVersion, eType);
|
||||||
|
|
||||||
|
if (nullptr == pCellParagraphs)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ECtrlObjectType::Character != pCellParagraphs->GetCtrls().back()->GetCtrlType())
|
||||||
|
pCellParagraphs->AddCtrl(new CCtrlCharacter(L" _", ECtrlCharType::PARAGRAPH_BREAK));
|
||||||
|
|
||||||
|
m_arParas.push_back(pCellParagraphs);
|
||||||
|
}
|
||||||
|
|
||||||
void CTblCell::SetVertAlign(EVertAlign eVertAlign)
|
void CTblCell::SetVertAlign(EVertAlign eVertAlign)
|
||||||
{
|
{
|
||||||
m_eVertAlign = eVertAlign;
|
m_eVertAlign = eVertAlign;
|
||||||
|
|||||||
@ -22,9 +22,14 @@ class CTblCell
|
|||||||
EVertAlign m_eVertAlign;
|
EVertAlign m_eVertAlign;
|
||||||
|
|
||||||
HWP_STRING m_sMergedColName;
|
HWP_STRING m_sMergedColName;
|
||||||
|
|
||||||
|
void ReadFromHWPX(CXMLReader& oReader, int nVersion);
|
||||||
|
void ReadFromHWPML(CXMLReader& oReader);
|
||||||
|
void ReadCellMargin(CXMLReader& oReader, EHanType eType);
|
||||||
|
void ReadCell(CXMLReader& oReader, int nVersion, EHanType eType);
|
||||||
public:
|
public:
|
||||||
CTblCell(int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
CTblCell(int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||||
CTblCell(CXMLReader& oReader, int nVersion);
|
CTblCell(CXMLReader& oReader, int nVersion, EHanType eType);
|
||||||
|
|
||||||
void SetVertAlign(EVertAlign eVertAlign);
|
void SetVertAlign(EVertAlign eVertAlign);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user