footnote changes

This commit is contained in:
Куликова Светлана Александровна
2020-07-10 16:41:21 +03:00
parent c9ba87d0bc
commit 173a429725
2 changed files with 47 additions and 21 deletions

View File

@ -922,28 +922,54 @@ public:
return false;
m_oLightReader.MoveToElement();
// Пишем сноску
oFootnotes += L"<w:footnote w:id=\"";
oFootnotes += std::to_wstring(nFootnote++);
oFootnotes += L"\">";
// Читаем внутренность section
int nSDepth = m_oLightReader.GetDepth();
while(m_oLightReader.ReadNextSiblingNode(nSDepth))
// Ищем сноску в списке требующихся
std::map<std::wstring, std::wstring>::iterator it = m_mFootnotes.find(sFootnoteName);
if(it != m_mFootnotes.end())
{
if(m_oLightReader.GetName() == L"p")
{
// Стиль section-p
oFootnotes += L"<w:p>";
oFootnotes += L"<w:pPr><w:pStyle w:val=\"footnote-p\"/></w:pPr>";
oFootnotes += L"<w:r><w:rPr><w:rStyle w:val=\"footnote\"/></w:rPr></w:r>";
if(!readP(L"", oFootnotes))
return false;
oFootnotes += L"</w:p>";
}
}
// Пишем сноску
oFootnotes += L"<w:footnote w:id=\"";
oFootnotes += it->second;
oFootnotes += L"\">";
oFootnotes += L"</w:footnote>";
// Читаем внутренность section
int nSDepth = m_oLightReader.GetDepth();
while(m_oLightReader.ReadNextSiblingNode(nSDepth))
{
std::wstring sName = m_oLightReader.GetName();
if(sName == L"title")
{
int nTDepth = m_oLightReader.GetDepth();
while(m_oLightReader.ReadNextSiblingNode(nTDepth))
{
if(m_oLightReader.GetName() == L"p")
{
// Стиль section-p
oFootnotes += L"<w:p>";
oFootnotes += L"<w:pPr><w:pStyle w:val=\"footnote-p\"/></w:pPr>";
oFootnotes += L"<w:r><w:rPr><w:rStyle w:val=\"footnote\"/></w:rPr></w:r>";
if(!readP(L"", oFootnotes))
return false;
oFootnotes += L"</w:p>";
}
}
}
else if(sName == L"p")
{
// Стиль section-p
oFootnotes += L"<w:p>";
oFootnotes += L"<w:pPr><w:pStyle w:val=\"footnote-p\"/></w:pPr>";
oFootnotes += L"<w:r><w:rPr><w:rStyle w:val=\"footnote\"/></w:rPr></w:r>";
if(!readP(L"", oFootnotes))
return false;
oFootnotes += L"</w:p>";
}
}
oFootnotes += L"</w:footnote>";
// Удаляем сноску из списка требующихся
m_mFootnotes.erase(it);
}
}
}
return true;