diff --git a/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp b/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp
index 5e90c91e0f..ed9befec3a 100644
--- a/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp
+++ b/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp
@@ -377,6 +377,17 @@ void CConverter2OOXML::WriteShape(const CCtrlGeneralShape* pShape, NSStringUtils
}
}
+void CConverter2OOXML::WriteNote(const CCtrlNote* pNote, short shParaShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
+{
+ oBuilder.WriteString(L"");
+
+ WriteRunnerStyle(oState.m_ushLastCharShapeId, oBuilder, oState, L"");
+
+ oBuilder.WriteString(m_oFootnoteConverter.CreateNote((const CCtrlNote*)pNote, *this));
+
+ oBuilder.WriteString(L"");
+}
+
void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
{
if (nullptr == pParagraph)
@@ -411,7 +422,7 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
++oState.m_unParaIndex;
- VECTOR arNoteRef;
+ std::vector arNotes;
for (const CCtrl* pCtrl : pParagraph->GetCtrls())
{
@@ -439,7 +450,7 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
}
case ECtrlObjectType::Note:
{
- arNoteRef.push_back(m_oFootnoteConverter.CreateNote((const CCtrlNote*)pCtrl, *this));
+ arNotes.push_back((const CCtrlNote*)pCtrl);
break;
}
case ECtrlObjectType::SectionDef:
@@ -461,20 +472,19 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
break;
}
- if (!arNoteRef.empty() && ECtrlObjectType::Note != pCtrl->GetCtrlType() && oState.m_bOpenedP)
+ if (!arNotes.empty() && ECtrlObjectType::Note != pCtrl->GetCtrlType() && oState.m_bOpenedP)
{
- for (const std::wstring& wsNoteRef : arNoteRef)
- oBuilder.WriteString(L"" + wsNoteRef + L"");
+ for (const CCtrlNote* pNote: arNotes)
+ WriteNote(pNote, pParagraph->GetShapeID(), oBuilder, oState);
- arNoteRef.clear();
+ arNotes.clear();
}
}
- if (oState.m_bOpenedP)
+ if (oState.m_bOpenedP && !arNotes.empty())
{
- if (!arNoteRef.empty())
- for (const std::wstring& wsNoteRef : arNoteRef)
- oBuilder.WriteString(L"" + wsNoteRef + L"");
+ for (const CCtrlNote* pNote: arNotes)
+ WriteNote(pNote, pParagraph->GetShapeID(), oBuilder, oState);
}
CloseParagraph(oBuilder, oState);
@@ -1212,7 +1222,7 @@ HWP_STRING CConverter2OOXML::SavePicture(const HWP_STRING& sBinItemId)
return AddRelationship(L"image", L"media/" + sFileName);
}
-void CConverter2OOXML::WriteRunnerStyle(short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
+void CConverter2OOXML::WriteRunnerStyle(short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState, const HWP_STRING& sExternStyles)
{
if (nullptr == m_pContext)
return;
@@ -1222,6 +1232,8 @@ void CConverter2OOXML::WriteRunnerStyle(short shCharShapeID, NSStringUtils::CStr
if (nullptr == pCharShape)
return;
+ oState.m_ushLastCharShapeId = shCharShapeID;
+
oBuilder.WriteString(L"");
HWP_STRING sFontFamily = pCharShape->GetFontName(ELang::LATIN);
@@ -1306,6 +1318,8 @@ void CConverter2OOXML::WriteRunnerStyle(short shCharShapeID, NSStringUtils::CStr
oBuilder.WriteString(L"");
+ oBuilder.WriteString(sExternStyles);
+
oBuilder.WriteString(L"");
switch(oState.m_eBreakType)
@@ -1786,8 +1800,8 @@ HWP_STRING CConverter2OOXML::GetTempDirectory() const
}
TConversionState::TConversionState()
- : m_bOpenedP(false), m_bOpenedR(false), m_ushSecdIndex(0), m_unParaIndex(0), m_pSectionDef(nullptr),
- m_pColumnDef(nullptr), m_eBreakType(EBreakType::None)
+ : m_bOpenedP(false), m_bOpenedR(false), m_ushLastCharShapeId(-1), m_ushSecdIndex(0), m_unParaIndex(0),
+ m_pSectionDef(nullptr), m_pColumnDef(nullptr), m_eBreakType(EBreakType::None)
{}
}
diff --git a/HwpFile/HwpDoc/Conversion/Converter2OOXML.h b/HwpFile/HwpDoc/Conversion/Converter2OOXML.h
index f23e0e58ee..a3ecf53854 100644
--- a/HwpFile/HwpDoc/Conversion/Converter2OOXML.h
+++ b/HwpFile/HwpDoc/Conversion/Converter2OOXML.h
@@ -28,6 +28,8 @@ struct TConversionState
bool m_bOpenedP;
bool m_bOpenedR;
+ unsigned short m_ushLastCharShapeId;
+
unsigned short m_ushSecdIndex;
unsigned int m_unParaIndex;
@@ -113,7 +115,7 @@ class CConverter2OOXML
HWP_STRING SavePicture(const HWP_STRING& sBinItemId);
void WriteParaShapeProperties(short shParaShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState);
- void WriteRunnerStyle(short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState);
+ void WriteRunnerStyle(short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState, const HWP_STRING& sExternStyles = L"");
void OpenDrawingNode(const CCtrlCommon* pCtrlShape, NSStringUtils::CStringBuilder& oBuilder);
void CloseDrawingNode(const CCtrlCommon* pCtrlShape, NSStringUtils::CStringBuilder& oBuilder);
@@ -135,6 +137,8 @@ class CConverter2OOXML
void WriteCharacter(const CCtrlCharacter* pCharacter, short shParaShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState);
void WriteShape(const CCtrlGeneralShape* pShape, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState);
+ void WriteNote(const CCtrlNote* pNote, short shParaShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState);
+
HWP_STRING AddRelationship(const HWP_STRING& wsType, const HWP_STRING& wsTarget);
void AddContentType(const HWP_STRING& wsName, const HWP_STRING& wsType);
void AddDefaultContentType(const HWP_STRING& wsName);