mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix bug #73573
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
|
||||
#include "../Paragraph/CtrlHeadFoot.h"
|
||||
#include "../Paragraph/CtrlSectionDef.h"
|
||||
#include "../Paragraph/CtrlPageNumPos.h"
|
||||
#include "../Paragraph/CtrlNewNumber.h"
|
||||
#include "../Paragraph/CtrlColumnDef.h"
|
||||
#include "../Paragraph/CtrlField.h"
|
||||
|
||||
@ -16,6 +18,7 @@ struct TConversionState
|
||||
bool m_bOpenedR;
|
||||
bool m_bIsNote;
|
||||
bool m_bInTable;
|
||||
bool m_bLastEmptyNode;
|
||||
|
||||
bool m_bInTextBox; // TODO:: используется, чтобы в wps:txbx не появилась новая фигура (посмотреть этот момент нужно подробнее)
|
||||
|
||||
@ -28,6 +31,8 @@ struct TConversionState
|
||||
|
||||
const CCtrlSectionDef* m_pSectionDef;
|
||||
const CCtrlColumnDef* m_pColumnDef;
|
||||
const CCtrlPageNumPos* m_pPageNum;
|
||||
const CCtrlNewNumber* m_pNewNumber;
|
||||
|
||||
enum class EBreakType
|
||||
{
|
||||
@ -40,8 +45,8 @@ struct TConversionState
|
||||
std::map<unsigned int, const CCtrlField*> m_mOpenField;
|
||||
|
||||
TConversionState()
|
||||
: m_bOpenedP(false), m_bOpenedR(false), m_bIsNote(false), m_bInTable(false), m_bInTextBox(false), m_ushLastCharShapeId(-1), m_ushSecdIndex(0), m_unParaIndex(0),
|
||||
m_pSectionDef(nullptr), m_pColumnDef(nullptr), m_eBreakType(EBreakType::None)
|
||||
: m_bOpenedP(false), m_bOpenedR(false), m_bIsNote(false), m_bInTable(false), m_bLastEmptyNode(false), m_bInTextBox(false), m_ushLastCharShapeId(-1), m_ushSecdIndex(0), m_unParaIndex(0),
|
||||
m_pSectionDef(nullptr), m_pColumnDef(nullptr), m_pPageNum(nullptr), m_pNewNumber(nullptr), m_eBreakType(EBreakType::None)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ void CConverter2OOXML::WriteCaption(const CCtrlCommon* pCtrlCommon, NSStringUtil
|
||||
|
||||
void CConverter2OOXML::WriteEmptyParagraph(short shParaShapeID, short shParaStyleID, short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
|
||||
{
|
||||
if (oState.m_bOpenedP)
|
||||
if (oState.m_bOpenedP || oState.m_bLastEmptyNode)
|
||||
return;
|
||||
|
||||
oBuilder.WriteString(L"<w:p>");
|
||||
@ -500,6 +500,8 @@ void CConverter2OOXML::WriteEmptyParagraph(short shParaShapeID, short shParaStyl
|
||||
|
||||
oBuilder.WriteString(L"</w:pPr>");
|
||||
oBuilder.WriteString(L"</w:p>");
|
||||
|
||||
oState.m_bLastEmptyNode = true;
|
||||
}
|
||||
|
||||
void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
|
||||
@ -580,6 +582,16 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
|
||||
oState.m_arCtrlsHeadFoot.push_back((const CCtrlHeadFoot*)pCtrl);
|
||||
break;
|
||||
}
|
||||
case ECtrlObjectType::PageNumPos:
|
||||
{
|
||||
oState.m_pPageNum = dynamic_cast<const CCtrlPageNumPos*>(pCtrl);
|
||||
break;
|
||||
}
|
||||
case HWP::ECtrlObjectType::NewNumber:
|
||||
{
|
||||
oState.m_pNewNumber = dynamic_cast<const CCtrlNewNumber*>(pCtrl);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -611,6 +623,9 @@ void CConverter2OOXML::WriteParaShapeProperties(short shParaShapeID, short shPar
|
||||
oBuilder.WriteString(L"\"/>");
|
||||
}
|
||||
|
||||
if (oState.m_bInTable)
|
||||
oBuilder.WriteString(L"<w:wordWrap w:val=\"1\"/>");
|
||||
|
||||
if (m_oStyleConverter.GetLastParaShapeId() != shParaShapeID)
|
||||
m_oStyleConverter.WriteDifferenceParagraphStyles(m_oStyleConverter.GetLastParaShapeId(), shParaShapeID, *m_pContext, oBuilder);
|
||||
|
||||
@ -642,9 +657,6 @@ void CConverter2OOXML::WriteParaShapeProperties(short shParaShapeID, short shPar
|
||||
case EHeadingType::NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
if (oState.m_bInTable)
|
||||
oBuilder.WriteString(L"<w:wordWrap w:val=\"1\"/>");
|
||||
}
|
||||
|
||||
void CConverter2OOXML::WriteTable(const CCtrlTable* pTable, short shParaShapeID, short shParaStyleID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
|
||||
@ -1146,21 +1158,34 @@ void CConverter2OOXML::WriteSectionSettings(TConversionState& oState)
|
||||
oState.m_arCtrlsHeadFoot.clear();
|
||||
}
|
||||
|
||||
#define WRITE_ID(id)\
|
||||
if (!id.empty() && id.length() > 6)\
|
||||
{\
|
||||
const std::wstring wsType = id.substr(0, 6);\
|
||||
AddContentType(id, L"application/vnd.openxmlformats-officedocument.wordprocessingml." + wsType + L"+xml");\
|
||||
m_oDocXml.WriteString(L"<w:" + wsType + L"Reference w:type=\"default\" r:id=\"" + AddRelationship(wsType, id) + L"\"/>");\
|
||||
}
|
||||
|
||||
if (nullptr != oState.m_pPageNum)
|
||||
{
|
||||
const std::wstring wsID = m_oFootnoteConverter.CreatePageNum(oState.m_pPageNum, *this);
|
||||
|
||||
WRITE_ID(wsID);
|
||||
|
||||
oState.m_pPageNum = nullptr;
|
||||
}
|
||||
|
||||
for (const CCtrlHeadFoot* pCtrlHeadFoot : arCtrlsHeadFoot)
|
||||
{
|
||||
const std::wstring wsID = m_oFootnoteConverter.CreateHeadOrFoot((const CCtrlHeadFoot*)pCtrlHeadFoot, *this);
|
||||
|
||||
if (!wsID.empty() && wsID.length() > 6)
|
||||
{
|
||||
const std::wstring wsType = wsID.substr(0, 6);
|
||||
|
||||
AddContentType(wsID, L"application/vnd.openxmlformats-officedocument.wordprocessingml." + wsType + L"+xml");
|
||||
|
||||
m_oDocXml.WriteString(L"<w:" + wsType + L"Reference w:type=\"default\" r:id=\"" + AddRelationship(wsType, wsID) + L"\"/>");
|
||||
}
|
||||
WRITE_ID(wsID);
|
||||
}
|
||||
}
|
||||
|
||||
if (nullptr != oState.m_pNewNumber && ENumType::PAGE == oState.m_pNewNumber->GetNumType())
|
||||
m_oDocXml.WriteString(L"<w:pgNumType w:start=\"" + std::to_wstring(oState.m_pNewNumber->GetNum()) + L"\"/>");
|
||||
|
||||
const CPage *pPage = (nullptr != oState.m_pSectionDef) ? oState.m_pSectionDef->GetPage() : nullptr;
|
||||
|
||||
if (nullptr == pPage)
|
||||
@ -1488,7 +1513,7 @@ void CConverter2OOXML::OpenDrawingNode(const CCtrlObjElement* pCtrlShape, NSStri
|
||||
L"\" distR=\"" + std::to_wstring(Transform::HWPUINT2OOXML(pCtrlShape->GetRightOutMargin() / 10)) +
|
||||
L"\">");
|
||||
|
||||
WriteShapeExtent(pCtrlShape, oBuilder);
|
||||
WriteShapeExtent(pCtrlShape, oBuilder, pWidth, pHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1659,6 +1684,7 @@ void CConverter2OOXML::OpenParagraph(short shParaShapeID, short shParaStyleID, N
|
||||
|
||||
oBuilder.WriteString(L"<w:p>");
|
||||
oState.m_bOpenedP = true;
|
||||
oState.m_bLastEmptyNode = false;
|
||||
WriteParagraphProperties(shParaShapeID, shParaStyleID, oBuilder, oState);
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +104,132 @@ std::wstring CFootnoteConverter::CreateHeadOrFoot(const CCtrlHeadFoot* pCtrlHead
|
||||
oFile.WriteStringUTF8(oNewDocumentBuilder.GetData());
|
||||
oFile.WriteStringUTF8(L"</w:" + wsNodeName + L">");
|
||||
|
||||
oFile.CloseFile();
|
||||
|
||||
return wsFileName;
|
||||
}
|
||||
|
||||
std::wstring CFootnoteConverter::CreatePageNum(const CCtrlPageNumPos* pCtrlPageNumPos, CConverter2OOXML& oConverter)
|
||||
{
|
||||
if (nullptr == pCtrlPageNumPos || ENumberShape2::DIGIT != pCtrlPageNumPos->GetFormatType() ||
|
||||
ENumPos::NONE == pCtrlPageNumPos->GetPos())
|
||||
return std::wstring();
|
||||
|
||||
std::wstring wsNodeName, wsJs;
|
||||
|
||||
switch(pCtrlPageNumPos->GetPos())
|
||||
{
|
||||
case ENumPos::TOP_LEFT:
|
||||
{
|
||||
wsNodeName = L"hdr";
|
||||
wsJs = L"left";
|
||||
break;
|
||||
}
|
||||
case ENumPos::TOP_CENTER:
|
||||
case ENumPos::TOP_OUTER:
|
||||
case ENumPos::TOP_INNER:
|
||||
{
|
||||
wsNodeName = L"hdr";
|
||||
wsJs = L"center";
|
||||
break;
|
||||
}
|
||||
case ENumPos::TOP_RIGHT:
|
||||
{
|
||||
wsNodeName = L"hdr";
|
||||
wsJs = L"right";
|
||||
break;
|
||||
}
|
||||
case ENumPos::BOTTOM_LEFT:
|
||||
{
|
||||
wsNodeName = L"ftr";
|
||||
wsJs = L"left";
|
||||
break;
|
||||
}
|
||||
case ENumPos::BOTTOM_CENTER:
|
||||
case ENumPos::BOTTOM_OUTER:
|
||||
case ENumPos::BOTTOM_INNER:
|
||||
{
|
||||
wsNodeName = L"ftr";
|
||||
wsJs = L"center";
|
||||
break;
|
||||
}
|
||||
case ENumPos::BOTTOM_RIGHT:
|
||||
{
|
||||
wsNodeName = L"ftr";
|
||||
wsJs = L"right";
|
||||
break;
|
||||
}
|
||||
case ENumPos::NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
const std::wstring wsFileName((L"hdr" == wsNodeName) ? (L"header" + std::to_wstring(++m_ushHeaderCount)) : (L"footer" + std::to_wstring(++m_ushFooterCount)) + L".xml");
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
if (!oFile.CreateFileW(oConverter.GetTempDirectory() + L"/word/" + wsFileName))
|
||||
return std::wstring();
|
||||
|
||||
oFile.WriteStringUTF8(L"<w:" + wsNodeName);
|
||||
oFile.WriteStringUTF8(L" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" "
|
||||
"xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" "
|
||||
"xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" "
|
||||
"xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\" "
|
||||
"xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" "
|
||||
"xmlns:cx4=\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" "
|
||||
"xmlns:cx5=\"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\" "
|
||||
"xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\" "
|
||||
"xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" "
|
||||
"xmlns:cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" "
|
||||
"xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" "
|
||||
"xmlns:aink=\"http://schemas.microsoft.com/office/drawing/2016/ink\" "
|
||||
"xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" "
|
||||
"xmlns:o=\"urn:schemas-microsoft-com:office:office\" "
|
||||
"xmlns:oel=\"http://schemas.microsoft.com/office/2019/extlst\" "
|
||||
"xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" "
|
||||
"xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" "
|
||||
"xmlns:v=\"urn:schemas-microsoft-com:vml\" "
|
||||
"xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" "
|
||||
"xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" "
|
||||
"xmlns:w10=\"urn:schemas-microsoft-com:office:word\" "
|
||||
"xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" "
|
||||
"xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" "
|
||||
"xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" "
|
||||
"xmlns:w16cex=\"http://schemas.microsoft.com/office/word/2018/wordml/cex\" "
|
||||
"xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\" "
|
||||
"xmlns:w16=\"http://schemas.microsoft.com/office/word/2018/wordml\" "
|
||||
"xmlns:w16du=\"http://schemas.microsoft.com/office/word/2023/wordml/word16du\" "
|
||||
"xmlns:w16sdtdh=\"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash\" "
|
||||
"xmlns:w16sdtfl=\"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock\" "
|
||||
"xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" "
|
||||
"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" "
|
||||
"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" "
|
||||
"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" "
|
||||
"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">");
|
||||
|
||||
oFile.WriteStringUTF8(L"<w:sdt><w:sdtContent><w:p>");
|
||||
|
||||
oFile.WriteStringUTF8(L"<w:pPr>");
|
||||
oFile.WriteStringUTF8(L"<w:jc w:val=\"" + wsJs + L"\"/>");
|
||||
oFile.WriteStringUTF8(L"</w:pPr>");
|
||||
|
||||
if (!pCtrlPageNumPos->GetPrefix().empty())
|
||||
oFile.WriteStringUTF8(L"<w:r><w:rPr><w:sz w:val=\"28\"/><w:szCs w:val=\"28\"/></w:rPr><w:t>" + pCtrlPageNumPos->GetPrefix() + L"</w:t></w:r>");
|
||||
|
||||
oFile.WriteStringUTF8(L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>");
|
||||
oFile.WriteStringUTF8(L"<w:r><w:instrText>PAGE \\* MERGEFORMAT</w:instrText></w:r>");
|
||||
oFile.WriteStringUTF8(L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>");
|
||||
oFile.WriteStringUTF8(L"<w:r><w:rPr><w:sz w:val=\"28\"/><w:szCs w:val=\"28\"/></w:rPr><w:t>2</w:t></w:r>");
|
||||
oFile.WriteStringUTF8(L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>");
|
||||
|
||||
if (!pCtrlPageNumPos->GetPostfix().empty())
|
||||
oFile.WriteStringUTF8(L"<w:r><w:rPr><w:sz w:val=\"28\"/><w:szCs w:val=\"28\"/></w:rPr><w:t>" + pCtrlPageNumPos->GetPostfix() + L"</w:t></w:r>");
|
||||
|
||||
oFile.WriteStringUTF8(L"</w:p></w:sdtContent></w:sdt>");
|
||||
|
||||
oFile.WriteStringUTF8(L"</w:" + wsNodeName + L">");
|
||||
|
||||
oFile.CloseFile();
|
||||
|
||||
return wsFileName;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include "../Paragraph/CtrlNote.h"
|
||||
#include "../Paragraph/CtrlHeadFoot.h"
|
||||
#include "../Paragraph/CtrlPageNumPos.h"
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
@ -24,6 +25,7 @@ public:
|
||||
|
||||
std::wstring CreateNote(const CCtrlNote* pNote, CConverter2OOXML& oConverter);
|
||||
std::wstring CreateHeadOrFoot(const CCtrlHeadFoot* pCtrlHeadFoot, CConverter2OOXML& oConverter);
|
||||
std::wstring CreatePageNum(const CCtrlPageNumPos* pCtrlPageNumPos, CConverter2OOXML& oConverter);
|
||||
|
||||
bool SaveToFile(const std::wstring& wsDirectory);
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
|
||||
namespace HWP
|
||||
{
|
||||
|
||||
enum class ENumType
|
||||
{
|
||||
PAGE,
|
||||
|
||||
@ -12,7 +12,7 @@ CCtrlNewNumber::CCtrlNewNumber(const HWP_STRING& sCtrlID, int nSize, CHWPStream&
|
||||
int nAttr;
|
||||
oBuffer.ReadInt(nAttr);
|
||||
|
||||
m_eNumType = GetNumType(nAttr & 0xF);
|
||||
m_eNumType = ::HWP::GetNumType(nAttr & 0xF);
|
||||
m_eNumShape = GetNumberShape2((nAttr >> 4) & 0xF);
|
||||
|
||||
oBuffer.ReadShort(m_shNum);
|
||||
@ -24,7 +24,7 @@ CCtrlNewNumber::CCtrlNewNumber(const HWP_STRING& sCtrlID, CXMLNode& oNode, int n
|
||||
: CCtrl(sCtrlID)
|
||||
{
|
||||
m_shNum = oNode.GetAttributeInt(L"num");
|
||||
m_eNumType = GetNumType(oNode.GetAttributeInt(L"numType"));
|
||||
m_eNumType = ::HWP::GetNumType(oNode.GetAttribute(L"numType"));
|
||||
//TODO:: проверить данный момент
|
||||
m_eNumShape = GetNumberShape2(oNode.GetAttributeInt(L"autoNumFormat"));
|
||||
|
||||
@ -35,4 +35,14 @@ ECtrlObjectType CCtrlNewNumber::GetCtrlType() const
|
||||
{
|
||||
return ECtrlObjectType::NewNumber;
|
||||
}
|
||||
|
||||
ENumType CCtrlNewNumber::GetNumType() const
|
||||
{
|
||||
return m_eNumType;
|
||||
}
|
||||
|
||||
short CCtrlNewNumber::GetNum() const
|
||||
{
|
||||
return m_shNum;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,9 @@ public:
|
||||
CCtrlNewNumber(const HWP_STRING& sCtrlID, CXMLNode& oNode, int nVersion);
|
||||
|
||||
ECtrlObjectType GetCtrlType() const override;
|
||||
|
||||
ENumType GetNumType() const;
|
||||
short GetNum() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -4,25 +4,37 @@ namespace HWP
|
||||
{
|
||||
ENumPos GetNumPos(int nValue)
|
||||
{
|
||||
switch(static_cast<ENumPos>(nValue))
|
||||
SWITCH(ENumPos, nValue)
|
||||
{
|
||||
case ENumPos::LEFT_TOP:
|
||||
case ENumPos::CENTER_TOP:
|
||||
case ENumPos::RIGHT_TOP:
|
||||
case ENumPos::LEFT_BOTTOM:
|
||||
case ENumPos::BOTTOM_CENTER:
|
||||
case ENumPos::RIGHT_BOTTOM:
|
||||
case ENumPos::OUTER_TOP:
|
||||
case ENumPos::OUTER_BOTTOM:
|
||||
case ENumPos::INNER_TOP:
|
||||
case ENumPos::INNER_BOTTOM:
|
||||
return static_cast<ENumPos>(nValue);
|
||||
case ENumPos::NONE:
|
||||
default:
|
||||
return ENumPos::NONE;
|
||||
DEFAULT(ENumPos::NONE);
|
||||
CASE(ENumPos::TOP_LEFT);
|
||||
CASE(ENumPos::TOP_CENTER);
|
||||
CASE(ENumPos::TOP_RIGHT);
|
||||
CASE(ENumPos::BOTTOM_LEFT);
|
||||
CASE(ENumPos::BOTTOM_CENTER);
|
||||
CASE(ENumPos::BOTTOM_RIGHT);
|
||||
CASE(ENumPos::TOP_OUTER);
|
||||
CASE(ENumPos::BOTTOM_OUTER);
|
||||
CASE(ENumPos::TOP_INNER);
|
||||
CASE(ENumPos::BOTTOM_INNER);
|
||||
}
|
||||
}
|
||||
|
||||
ENumPos GetNumPos(const HWP_STRING& sValue)
|
||||
{
|
||||
IF_STRING_IN_ENUM(TOP_LEFT, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(TOP_CENTER, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(TOP_RIGHT, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(BOTTOM_LEFT, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(BOTTOM_CENTER, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(BOTTOM_RIGHT, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(TOP_OUTER, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(BOTTOM_OUTER, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(TOP_INNER, sValue, ENumPos);
|
||||
ELSE_IF_STRING_IN_ENUM(BOTTOM_INNER, sValue, ENumPos);
|
||||
ELSE_STRING_IN_ENUM(NONE, ENumPos);
|
||||
}
|
||||
|
||||
CCtrlPageNumPos::CCtrlPageNumPos(const HWP_STRING& sCtrlID)
|
||||
: CCtrl(sCtrlID)
|
||||
{}
|
||||
@ -45,8 +57,31 @@ CCtrlPageNumPos::CCtrlPageNumPos(const HWP_STRING& sCtrlID, int nSize, CHWPStrea
|
||||
CCtrlPageNumPos::CCtrlPageNumPos(const HWP_STRING& sCtrlID, CXMLNode& oNode, int nVersion)
|
||||
: CCtrl(sCtrlID)
|
||||
{
|
||||
m_ePos = GetNumPos(oNode.GetAttributeInt(L"pos"));
|
||||
m_ePos = GetNumPos(oNode.GetAttribute(L"pos"));
|
||||
m_eNumShape = GetNumberShape2(oNode.GetAttributeInt(L"formatType"));
|
||||
|
||||
m_sPostfix = oNode.GetAttribute(L"sideChar");
|
||||
m_sPrefix = m_sPostfix;
|
||||
}
|
||||
|
||||
ENumPos CCtrlPageNumPos::GetPos() const
|
||||
{
|
||||
return m_ePos;
|
||||
}
|
||||
|
||||
HWP_STRING CCtrlPageNumPos::GetPrefix() const
|
||||
{
|
||||
return m_sPrefix;
|
||||
}
|
||||
|
||||
HWP_STRING CCtrlPageNumPos::GetPostfix() const
|
||||
{
|
||||
return m_sPostfix;
|
||||
}
|
||||
|
||||
ENumberShape2 CCtrlPageNumPos::GetFormatType() const
|
||||
{
|
||||
return m_eNumShape;
|
||||
}
|
||||
|
||||
ECtrlObjectType CCtrlPageNumPos::GetCtrlType() const
|
||||
|
||||
@ -11,16 +11,16 @@ namespace HWP
|
||||
enum class ENumPos
|
||||
{
|
||||
NONE,
|
||||
LEFT_TOP,
|
||||
CENTER_TOP,
|
||||
RIGHT_TOP,
|
||||
LEFT_BOTTOM,
|
||||
TOP_LEFT,
|
||||
TOP_CENTER,
|
||||
TOP_RIGHT,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_CENTER,
|
||||
RIGHT_BOTTOM,
|
||||
OUTER_TOP,
|
||||
OUTER_BOTTOM,
|
||||
INNER_TOP,
|
||||
INNER_BOTTOM
|
||||
BOTTOM_RIGHT,
|
||||
TOP_OUTER,
|
||||
BOTTOM_OUTER,
|
||||
TOP_INNER,
|
||||
BOTTOM_INNER
|
||||
};
|
||||
|
||||
class CCtrlPageNumPos : public CCtrl
|
||||
@ -36,6 +36,13 @@ public:
|
||||
CCtrlPageNumPos(const HWP_STRING& sCtrlID, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
|
||||
CCtrlPageNumPos(const HWP_STRING& sCtrlID, CXMLNode& oNode, int nVersion);
|
||||
|
||||
ENumPos GetPos() const;
|
||||
|
||||
HWP_STRING GetPrefix() const;
|
||||
HWP_STRING GetPostfix() const;
|
||||
|
||||
ENumberShape2 GetFormatType() const;
|
||||
|
||||
ECtrlObjectType GetCtrlType() const override;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user