Commit 623d89d1 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatReader - two and more levels in fields (contents, ...)

parent fb9d2cbf
......@@ -2380,6 +2380,14 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
{
m_oCurTab.m_eKind = RtfTab::tk_tqbar;
m_oCurTab.m_nTab = parameter;
if (!oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.empty())
{
if (oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.back().m_nTab > m_oCurTab.m_nTab)
{
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.clear();
}
}
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.push_back( m_oCurTab );
m_oCurTab.SetDefault();
}
......@@ -2389,6 +2397,14 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
if ( hasParameter )
{
m_oCurTab.m_nTab = parameter;
if (!oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.empty())
{
if (oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.back().m_nTab > m_oCurTab.m_nTab)
{
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.clear();
}
}
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.push_back( m_oCurTab );
m_oCurTab.SetDefault();
}
......
......@@ -49,7 +49,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -59,7 +59,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -89,7 +89,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -99,7 +99,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -356,7 +356,7 @@ CString RtfCharSpecial::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -366,7 +366,7 @@ CString RtfCharSpecial::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......
......@@ -164,7 +164,7 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
sAuthor = m_pInsert->m_oCharProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_pInsert->m_oCharProperty.m_nRevauth] : L"";
sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_pInsert->m_oCharProperty.m_nRevauth);
sDate = CString(RtfUtility::convertDateTime(m_pInsert->m_oCharProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -174,7 +174,7 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
sAuthor = m_pInsert->m_oCharProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_pInsert->m_oCharProperty.m_nRevauthDel ] : L"";
sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_pInsert->m_oCharProperty.m_nRevauthDel);
sDate = CString(RtfUtility::convertDateTime(m_pInsert->m_oCharProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -229,13 +229,15 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
sResult += props;
sResult += L"<w:fldChar w:fldCharType=\"begin\"/>";
sResult += L"</w:r>";
CString str = Utils::PrepareToXML( m_pInsert->m_pTextItems->RenderToOOX(oNewParametr) );
//-----------
sResult += L"<w:r>";
sResult += L"<w:instrText xml:space=\"preserve\">";
sResult += str;
if (m_pInsert->m_pTextItems)
{
sResult += Utils::PrepareToXML( m_pInsert->m_pTextItems->RenderToOOX(oNewParametr) );
}
sResult += L"</w:instrText></w:r>";
// разделитель
......@@ -243,11 +245,33 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
sResult += L"<w:fldChar w:fldCharType=\"separate\"/></w:r>";
//пишем содержание-кэш
if ((m_pResult->m_pTextItems) && (m_pResult->m_pTextItems->GetCount() > 0))
{
oNewParametr.nType = RENDER_TO_OOX_PARAM_RUN;
sResult += m_pResult->m_pTextItems->m_aArray[0]->RenderToOOX(oNewParametr);
for (int i = 1; i < m_pResult->m_pTextItems->GetCount(); i++)
{
RtfParagraph *paragraph = dynamic_cast<RtfParagraph *>(m_pResult->m_pTextItems->m_aArray[i].get());
if (paragraph)
{
sResult += L"</w:p>";
sResult += L"<w:p>";
sResult += L"<w:pPr>";
sResult += paragraph->m_oProperty.RenderToOOX(oRenderParameter);
sResult += L"</w:pPr>";
}
sResult += m_pResult->m_pTextItems->m_aArray[i]->RenderToOOX(oNewParametr);
}
}
else
{
sResult += L"<w:r>";
if (!props.IsEmpty())
sResult += props;
sResult += m_pResult->m_pTextItems->RenderToOOX(oNewParametr);
sResult += L"</w:r>";
}
//заканчиваем Field
sResult += L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
......
......@@ -466,6 +466,14 @@ public:
i = AddItem(author);
return i;
}
CString GetAuthor(int ind)
{
if (ind == PROP_DEF || ind > m_aArray.size())
return L"";
return m_aArray[ind];
}
};
//class RtfRSIDTable : public IDocumentElement, public ItemContainer<rsidString>
......
......@@ -60,7 +60,7 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = pCharProps->m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ pCharProps->m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(pCharProps->m_nRevauth);
CString sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -70,7 +70,7 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = pCharProps->m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ pCharProps->m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(pCharProps->m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......
......@@ -747,7 +747,7 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauth);
CString sDate(RtfUtility::convertDateTime( m_nRevdttm ).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -757,7 +757,7 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime( m_nRevdttmDel ).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -768,14 +768,14 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if ( PROP_DEF != m_nDeleted )//для rPr в pPr
{
CString sAuthor = m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauthDel] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
}
if ( PROP_DEF != m_nRevised )
{
CString sAuthor = m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
......@@ -962,7 +962,7 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if (m_pOldCharProp)
{
CString sAuthor = m_nCrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nCrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nCrAuth);
CString sDate(RtfUtility::convertDateTime(m_nCrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;
......@@ -2168,7 +2168,7 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
if (m_pOldParagraphProp)
{
CString sAuthor = m_nPrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nPrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nPrAuth);
CString sDate(RtfUtility::convertDateTime(m_nPrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;
......@@ -2859,19 +2859,19 @@ CString RtfRowProperty::RenderToOOX(RenderParameter oRenderParameter)
m_pOldRowProperty;
//if ( PROP_DEF != oReader.m_oState->m_oCharProp.m_nDeleted )
//{
// CString sAuthor = oReader.m_oState->m_oCharProp.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ oReader.m_oState->m_oCharProp.m_nRevauthDel] : L"";
// CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(oReader.m_oState->m_oCharProp.m_nRevauthDel);
// CString sDate(RtfUtility::convertDateTime(oReader.m_oState->m_oCharProp.m_nRevdttmDel).c_str());
// sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
//}
//if ( PROP_DEF != oReader.m_oState->m_oCharProp.m_nRevised )
//{
// CString sAuthor = m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ oReader.m_oState->m_oCharProp.m_nRevauth] : L"";
// CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(oReader.m_oState->m_oCharProp.m_nRevauth);
// CString sDate(RtfUtility::convertDateTime(oReader.m_oState->m_oCharProp.m_nRevdttm).c_str());
//
// sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
//}
CString sAuthor = m_nTrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nTrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nTrAuth);
CString sDate(RtfUtility::convertDateTime(m_nTrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;
......
......@@ -823,7 +823,7 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
}
if (m_pOldSectionProp)
{
CString sAuthor = m_nSrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nSrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nSrAuth);
CString sDate(RtfUtility::convertDateTime(m_nSrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;
......
......@@ -753,7 +753,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
m_bInsert = true;
CString sAuthor = m_oCharProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oCharProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oCharProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oCharProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......@@ -763,7 +763,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
m_bDelete = true;
CString sAuthor = m_oCharProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oCharProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oCharProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oCharProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment