Commit 6c8b05b3 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

(2.0.2.336) x2t revision history for math

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@66667 954022d7-b5bf-4e40-9824-e11837661b57
parent 0954cf3b
...@@ -2514,6 +2514,7 @@ public: ...@@ -2514,6 +2514,7 @@ public:
XmlUtils::CStringWriter* trPr; XmlUtils::CStringWriter* trPr;
XmlUtils::CStringWriter* tcPr; XmlUtils::CStringWriter* tcPr;
XmlUtils::CStringWriter* content; XmlUtils::CStringWriter* content;
XmlUtils::CStringWriter* contentRun;
TrackRevision() TrackRevision()
{ {
Id = NULL; Id = NULL;
...@@ -2527,6 +2528,7 @@ public: ...@@ -2527,6 +2528,7 @@ public:
trPr = NULL; trPr = NULL;
tcPr = NULL; tcPr = NULL;
content = NULL; content = NULL;
contentRun = NULL;
} }
~TrackRevision() ~TrackRevision()
{ {
...@@ -2541,6 +2543,7 @@ public: ...@@ -2541,6 +2543,7 @@ public:
RELEASEOBJECT(trPr); RELEASEOBJECT(trPr);
RELEASEOBJECT(tcPr); RELEASEOBJECT(tcPr);
RELEASEOBJECT(content); RELEASEOBJECT(content);
RELEASEOBJECT(contentRun);
} }
bool IsNoEmpty() bool IsNoEmpty()
{ {
...@@ -2591,7 +2594,7 @@ public: ...@@ -2591,7 +2594,7 @@ public:
CString sId;sId.Format(_T(" w:vMergeOrig=\"%d\""), *vMergeOrigin); CString sId;sId.Format(_T(" w:vMergeOrig=\"%d\""), *vMergeOrigin);
pCStringWriter->WriteString(sId); pCStringWriter->WriteString(sId);
} }
if(NULL != RPr || NULL != PPr || NULL != sectPr || NULL != tblPr || NULL != tblGridChange || NULL != trPr || NULL != tcPr || NULL != content) if(NULL != RPr || NULL != PPr || NULL != sectPr || NULL != tblPr || NULL != tblGridChange || NULL != trPr || NULL != tcPr || NULL != content|| NULL != contentRun)
{ {
pCStringWriter->WriteString(CString(_T(">"))); pCStringWriter->WriteString(CString(_T(">")));
if(NULL != RPr) if(NULL != RPr)
...@@ -2636,6 +2639,10 @@ public: ...@@ -2636,6 +2639,10 @@ public:
{ {
pCStringWriter->Write(*content); pCStringWriter->Write(*content);
} }
if(NULL != contentRun)
{
pCStringWriter->Write(*contentRun);
}
pCStringWriter->WriteString(CString(_T("</"))); pCStringWriter->WriteString(CString(_T("</")));
pCStringWriter->WriteString(sName); pCStringWriter->WriteString(sName);
......
...@@ -3946,10 +3946,27 @@ public: ...@@ -3946,10 +3946,27 @@ public:
if(m_oMath_rPr.IsNoEmpty()) if(m_oMath_rPr.IsNoEmpty())
m_oMath_rPr.Write(&GetRunStringWriter()); m_oMath_rPr.Write(&GetRunStringWriter());
} }
else if ( c_oSerRunType::del == type )
{
TrackRevision oRPrChange;
res = Read1(length, &Binary_DocumentTableReader::ReadMathCtrlPrDelIns, this, &oRPrChange);
oRPrChange.Write(&GetRunStringWriter(), _T("w:del"));
}
else if ( c_oSerRunType::ins == type )
{
TrackRevision oRPrChange;
res = Read1(length, &Binary_DocumentTableReader::ReadMathCtrlPrDelIns, this, &oRPrChange);
oRPrChange.Write(&GetRunStringWriter(), _T("w:ins"));
}
else else
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
} }
int ReadMathCtrlPrDelIns(BYTE type, long length, void* poResult)
{
return oBinary_rPrReader.ReadrPrChange(type, length, poResult);
}
int ReadMathDelimiter(BYTE type, long length, void* poResult) int ReadMathDelimiter(BYTE type, long length, void* poResult)
{ {
int res = c_oSerConstants::ReadOk; int res = c_oSerConstants::ReadOk;
...@@ -4935,10 +4952,39 @@ public: ...@@ -4935,10 +4952,39 @@ public:
{ {
GetRunStringWriter().WriteString(CString(_T("<w:br />"))); GetRunStringWriter().WriteString(CString(_T("<w:br />")));
} }
else if (c_oSer_OMathContentType::Del == type)
{
TrackRevision oTrackRevision;
res = Read1(length, &Binary_DocumentTableReader::ReadMathInsDel, this, &oTrackRevision);
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
}
else if (c_oSer_OMathContentType::Ins == type)
{
TrackRevision oTrackRevision;
res = Read1(length, &Binary_DocumentTableReader::ReadMathInsDel, this, &oTrackRevision);
oTrackRevision.Write(&GetRunStringWriter(), _T("w:ins"));
}
else else
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
} }
int ReadMathInsDel(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
TrackRevision* pTrackRevision = static_cast<TrackRevision*>(poResult);
READ1_TRACKREV(type, length, pTrackRevision)
else if(c_oSerProp_RevisionType::ContentRun == type)
{
pTrackRevision->contentRun = new XmlUtils::CStringWriter();
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
m_pCurWriter = pTrackRevision->contentRun;
res = Read1(length, &Binary_DocumentTableReader::ReadMathMRun, this, NULL);
m_pCurWriter = pPrevWriter;
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadMathRad(BYTE type, long length, void* poResult) int ReadMathRad(BYTE type, long length, void* poResult)
{ {
int res = c_oSerConstants::ReadOk; int res = c_oSerConstants::ReadOk;
......
...@@ -444,7 +444,9 @@ extern int g_nCurFormatVersion; ...@@ -444,7 +444,9 @@ extern int g_nCurFormatVersion;
CommentReference = 11, CommentReference = 11,
pptxDrawing = 12, pptxDrawing = 12,
object = 14, object = 14,
delText = 15 delText = 15,
del = 16,
ins = 17
};} };}
namespace c_oSerImageType{enum c_oSerImageType namespace c_oSerImageType{enum c_oSerImageType
{ {
...@@ -790,7 +792,9 @@ extern int g_nCurFormatVersion; ...@@ -790,7 +792,9 @@ extern int g_nCurFormatVersion;
CtrlPr = 58, CtrlPr = 58,
pagebreak = 59, pagebreak = 59,
linebreak = 60, linebreak = 60,
Run = 61 Run = 61,
Ins = 62,
Del = 63
};} };}
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
{ {
...@@ -846,7 +850,8 @@ extern int g_nCurFormatVersion; ...@@ -846,7 +850,8 @@ extern int g_nCurFormatVersion;
tblGridChange = 10, tblGridChange = 10,
tblPrChange = 11, tblPrChange = 11,
tcPrChange = 12, tcPrChange = 12,
trPrChange = 13 trPrChange = 13,
ContentRun = 14
};} };}
} }
......
...@@ -3167,15 +3167,7 @@ namespace BinDocxRW ...@@ -3167,15 +3167,7 @@ namespace BinDocxRW
case OOX::et_m_ctrlPr: case OOX::et_m_ctrlPr:
{ {
OOX::Logic::CCtrlPr* pCtrlPr = static_cast<OOX::Logic::CCtrlPr*>(item); OOX::Logic::CCtrlPr* pCtrlPr = static_cast<OOX::Logic::CCtrlPr*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::CtrlPr); WriteMathCtrlPr(*pCtrlPr, c_oSer_OMathContentType::CtrlPr);
if ( pCtrlPr->m_oRPr.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerRunType::rPr);
brPrs.Write_rPr(pCtrlPr->m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
m_oBcw.WriteItemEnd(nCurPos);
break; break;
} }
case OOX::et_m_d: case OOX::et_m_d:
...@@ -3341,34 +3333,7 @@ namespace BinDocxRW ...@@ -3341,34 +3333,7 @@ namespace BinDocxRW
{ {
OOX::Logic::CMRun* pMRun = static_cast<OOX::Logic::CMRun*>(item); OOX::Logic::CMRun* pMRun = static_cast<OOX::Logic::CMRun*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MRun); nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MRun);
WriteMathRunContent(pMRun);
if ( pMRun->m_oMRPr.IsInit() )
WriteMathMRPr(pMRun->m_oMRPr.get());
if ( pMRun->m_oRPr.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSer_OMathContentType::RPr);
brPrs.Write_rPr(pMRun->m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
if ( pMRun->m_oMText.IsInit() )
WriteMathText(pMRun->m_oMText.get());
if ( pMRun->m_oBr.IsInit() )
{
int nBreakType = -1;
switch(pMRun->m_oBr->m_oType.GetValue())
{
case SimpleTypes::brtypeColumn:
case SimpleTypes::brtypePage: nBreakType = c_oSer_OMathContentType::pagebreak;break;
case SimpleTypes::brtypeTextWrapping: nBreakType = c_oSer_OMathContentType::linebreak;break;
}
if(-1 != nBreakType)
{
m_oBcw.m_oStream.WriteBYTE(nBreakType);
m_oBcw.m_oStream.WriteLONG(c_oSerPropLenType::Null);
}
}
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
break; break;
} }
...@@ -3454,6 +3419,47 @@ namespace BinDocxRW ...@@ -3454,6 +3419,47 @@ namespace BinDocxRW
} }
} }
} }
void WriteMathRunContent(OOX::Logic::CMRun* pMRun)
{
if ( pMRun->m_oMRPr.IsInit() )
WriteMathMRPr(pMRun->m_oMRPr.get());
if ( pMRun->m_oRPr.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSer_OMathContentType::RPr);
brPrs.Write_rPr(pMRun->m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
if ( pMRun->m_oMText.IsInit() )
WriteMathText(pMRun->m_oMText.get());
if ( pMRun->m_oBr.IsInit() )
{
int nBreakType = -1;
switch(pMRun->m_oBr->m_oType.GetValue())
{
case SimpleTypes::brtypeColumn:
case SimpleTypes::brtypePage: nBreakType = c_oSer_OMathContentType::pagebreak;break;
case SimpleTypes::brtypeTextWrapping: nBreakType = c_oSer_OMathContentType::linebreak;break;
}
if(-1 != nBreakType)
{
m_oBcw.m_oStream.WriteBYTE(nBreakType);
m_oBcw.m_oStream.WriteLONG(c_oSerPropLenType::Null);
}
}
if ( pMRun->m_oDel.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSer_OMathContentType::Del);
WriteMathDel(pMRun->m_oDel.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
if ( pMRun->m_oIns.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSer_OMathContentType::Ins);
WriteMathIns(pMRun->m_oIns.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
}
void WriteMathAccPr(const OOX::Logic::CAccPr &pAccPr) void WriteMathAccPr(const OOX::Logic::CAccPr &pAccPr)
{ {
int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::AccPr); int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::AccPr);
...@@ -3656,9 +3662,9 @@ namespace BinDocxRW ...@@ -3656,9 +3662,9 @@ namespace BinDocxRW
} }
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
void WriteMathCtrlPr(const OOX::Logic::CCtrlPr &pCtrlPr) void WriteMathCtrlPr(const OOX::Logic::CCtrlPr &pCtrlPr, BYTE type = c_oSer_OMathBottomNodesType::CtrlPr)
{ {
int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathBottomNodesType::CtrlPr); int nCurPos = m_oBcw.WriteItemStart(type);
if ( pCtrlPr.m_oRPr.IsInit() ) if ( pCtrlPr.m_oRPr.IsInit() )
{ {
...@@ -3666,6 +3672,18 @@ namespace BinDocxRW ...@@ -3666,6 +3672,18 @@ namespace BinDocxRW
brPrs.Write_rPr(pCtrlPr.m_oRPr.get()); brPrs.Write_rPr(pCtrlPr.m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos2); m_oBcw.WriteItemEnd(nCurPos2);
} }
if ( pCtrlPr.m_oDel.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerRunType::del);
brPrs.Write_rPrChange(pCtrlPr.m_oDel.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
if ( pCtrlPr.m_oIns.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerRunType::ins);
brPrs.Write_rPrChange(pCtrlPr.m_oIns.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
void WriteMathDelimiter(const std::vector<OOX::WritingElement*>& m_arrItems, LONG &lColumn) void WriteMathDelimiter(const std::vector<OOX::WritingElement*>& m_arrItems, LONG &lColumn)
...@@ -4569,6 +4587,29 @@ namespace BinDocxRW ...@@ -4569,6 +4587,29 @@ namespace BinDocxRW
} }
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
void WriteMathDel(const OOX::Logic::CMDel &pMDel)
{
int nCurPos = 0;
m_oBcw.WriteTrackRevision(pMDel);
if(pMDel.m_oRun.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::ContentRun);
WriteMathRunContent(pMDel.m_oRun.GetPointer());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteMathIns(const OOX::Logic::CMIns &pMIns)
{
int nCurPos = 0;
m_oBcw.WriteTrackRevision(pMIns);
if(pMIns.m_oRun.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::ContentRun);
WriteMathRunContent(pMIns.m_oRun.GetPointer());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteMathText(const OOX::Logic::CMText &pMText) void WriteMathText(const OOX::Logic::CMText &pMText)
{ {
int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MText); int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MText);
......
#include "AlternateContent.h" #include "AlternateContent.h"
#include "Run.h" #include "Run.h"
namespace OOX namespace OOX
...@@ -36,13 +36,9 @@ namespace OOX ...@@ -36,13 +36,9 @@ namespace OOX
for (unsigned int i = 0; i < altRun.m_arrItems.size(); ++i) for (unsigned int i = 0; i < altRun.m_arrItems.size(); ++i)
m_arrChoiceItems.push_back(altRun.m_arrItems[i]); m_arrChoiceItems.push_back(altRun.m_arrItems[i]);
for (unsigned int i = 0; i < altRun.m_arrSpreadsheetItems.size(); ++i)
m_arrSpreadsheetChoiceItems.push_back(altRun.m_arrSpreadsheetItems[i]);
// RemoveAll altRun //без RemoveAll они очистятся вместе с altRun
altRun.m_arrItems.clear(); altRun.m_arrItems.clear();
altRun.m_arrSpreadsheetItems.clear();
} }
else if ( _T("mc:Fallback") == sName ) else if ( _T("mc:Fallback") == sName )
{ {
...@@ -50,13 +46,9 @@ namespace OOX ...@@ -50,13 +46,9 @@ namespace OOX
for (unsigned int i = 0; i < altRun.m_arrItems.size(); ++i) for (unsigned int i = 0; i < altRun.m_arrItems.size(); ++i)
m_arrFallbackItems.push_back(altRun.m_arrItems[i]); m_arrFallbackItems.push_back(altRun.m_arrItems[i]);
for (unsigned int i = 0; i < altRun.m_arrSpreadsheetItems.size(); ++i)
m_arrSpreadsheetFallbackItems.push_back(altRun.m_arrSpreadsheetItems[i]);
// RemoveAll altRun //без RemoveAll они очистятся вместе с altRun
altRun.m_arrItems.clear(); altRun.m_arrItems.clear();
altRun.m_arrSpreadsheetItems.clear();
} }
} }
} }
......
#pragma once #pragma once
#ifndef OOX_LOGIC_RUN_INCLUDE_H_ #ifndef OOX_LOGIC_RUN_INCLUDE_H_
#define OOX_LOGIC_RUN_INCLUDE_H_ #define OOX_LOGIC_RUN_INCLUDE_H_
...@@ -61,13 +61,6 @@ namespace OOX ...@@ -61,13 +61,6 @@ namespace OOX
m_oRsidRPr.reset(); m_oRsidRPr.reset();
m_oRunProperty = NULL; m_oRunProperty = NULL;
for (unsigned int nIndex = 0; nIndex < m_arrSpreadsheetItems.size(); nIndex++ )
{
if ( m_arrItems[nIndex] )delete m_arrSpreadsheetItems[nIndex];
m_arrSpreadsheetItems[nIndex] = NULL;
}
m_arrSpreadsheetItems.clear();
for (unsigned int nIndex = 0; nIndex < m_arrItems.size(); nIndex++ ) for (unsigned int nIndex = 0; nIndex < m_arrItems.size(); nIndex++ )
{ {
if ( m_arrItems[nIndex] )delete m_arrItems[nIndex]; if ( m_arrItems[nIndex] )delete m_arrItems[nIndex];
...@@ -188,7 +181,6 @@ namespace OOX ...@@ -188,7 +181,6 @@ namespace OOX
{ {
CWCharWrapper sName = oReader.GetName(); CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL; WritingElement *pItem = NULL;
OOX::Spreadsheet::WritingElement *pSpreadsheetItem = NULL;
if ( _T("mc:AlternateContent") == sName ) if ( _T("mc:AlternateContent") == sName )
pItem = new CAlternateContent( oReader ); pItem = new CAlternateContent( oReader );
...@@ -263,8 +255,6 @@ namespace OOX ...@@ -263,8 +255,6 @@ namespace OOX
if ( pItem ) if ( pItem )
m_arrItems.push_back( pItem ); m_arrItems.push_back( pItem );
if ( pSpreadsheetItem )
m_arrSpreadsheetItems.push_back( pSpreadsheetItem );
} }
} }
virtual CString toXML() const virtual CString toXML() const
...@@ -288,15 +278,6 @@ namespace OOX ...@@ -288,15 +278,6 @@ namespace OOX
sResult += m_arrItems[nIndex]->toXML(); sResult += m_arrItems[nIndex]->toXML();
} }
} }
for (unsigned int nIndex = 0; nIndex < m_arrSpreadsheetItems.size(); nIndex++ )
{
if ( m_arrSpreadsheetItems[nIndex] )
{
if (m_arrItems[nIndex]->getType() == OOX::Spreadsheet::et_rPr) continue;
sResult += m_arrSpreadsheetItems[nIndex]->toXML();
}
}
sResult += _T("</w:r>"); sResult += _T("</w:r>");
...@@ -344,10 +325,8 @@ namespace OOX ...@@ -344,10 +325,8 @@ namespace OOX
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidRPr; nullable<SimpleTypes::CLongHexNumber<> > m_oRsidRPr;
// Childs // Childs
std::vector<OOX::Spreadsheet::WritingElement *> m_arrSpreadsheetItems; OOX::Logic::CRunProperty *m_oRunProperty; // копия того что в m_arrItems... - для быстрого доступа/анализа
// по идее нужно сделать как в Drawing::Run - то есть единственные подобъекты вынести отдельно
OOX::Logic::CRunProperty *m_oRunProperty; // m_arrItems... - /
// Drawing::Run -
}; };
} // namespace Logic } // namespace Logic
} // namespace OOX } // namespace OOX
......
...@@ -295,114 +295,122 @@ namespace OOX ...@@ -295,114 +295,122 @@ namespace OOX
{ {
CString sResult = _T("<m:r>"); CString sResult = _T("<m:r>");
if ( m_oAnnotationRef.IsInit() ) sResult += toXMLInner();
sResult += m_oAnnotationRef->toXML();
sResult += _T("</m:r>");
if ( m_oBr.IsInit() ) return sResult;
sResult += m_oBr->toXML(); }
CString CMRun::toXMLInner() const
{
CString sResult;
if ( m_oCommentReference.IsInit() ) if ( m_oAnnotationRef.IsInit() )
sResult += m_oCommentReference->toXML(); sResult += m_oAnnotationRef->toXML();
if ( m_oContentPart.IsInit() ) if ( m_oBr.IsInit() )
sResult += m_oContentPart->toXML(); sResult += m_oBr->toXML();
if ( m_oContinuationSeparator.IsInit() ) if ( m_oCommentReference.IsInit() )
sResult += m_oContinuationSeparator->toXML(); sResult += m_oCommentReference->toXML();
if ( m_oCr.IsInit() ) if ( m_oContentPart.IsInit() )
sResult += m_oCr->toXML(); sResult += m_oContentPart->toXML();
if ( m_oDayLong.IsInit() ) if ( m_oContinuationSeparator.IsInit() )
sResult += m_oDayLong->toXML(); sResult += m_oContinuationSeparator->toXML();
if ( m_oDayShort.IsInit() ) if ( m_oCr.IsInit() )
sResult += m_oDayShort->toXML(); sResult += m_oCr->toXML();
if ( m_oDelInstrText.IsInit() ) if ( m_oDayLong.IsInit() )
sResult += m_oDelInstrText->toXML(); sResult += m_oDayLong->toXML();
if ( m_oDelText.IsInit() ) if ( m_oDayShort.IsInit() )
sResult += m_oDelText->toXML(); sResult += m_oDayShort->toXML();
if ( m_oDrawing.IsInit() ) if ( m_oDelInstrText.IsInit() )
sResult += m_oDrawing->toXML(); sResult += m_oDelInstrText->toXML();
if ( m_oEndnoteRef.IsInit() ) if ( m_oDelText.IsInit() )
sResult += m_oEndnoteRef->toXML(); sResult += m_oDelText->toXML();
if ( m_oEndnoteReference.IsInit() ) if ( m_oDrawing.IsInit() )
sResult += m_oEndnoteReference->toXML(); sResult += m_oDrawing->toXML();
if ( m_oFldChar.IsInit() ) if ( m_oEndnoteRef.IsInit() )
sResult += m_oFldChar->toXML(); sResult += m_oEndnoteRef->toXML();
if ( m_oFootnoteRef.IsInit() ) if ( m_oEndnoteReference.IsInit() )
sResult += m_oFootnoteRef->toXML(); sResult += m_oEndnoteReference->toXML();
if ( m_oFootnoteReference.IsInit() ) if ( m_oFldChar.IsInit() )
sResult += m_oFootnoteReference->toXML(); sResult += m_oFldChar->toXML();
if ( m_oInstrText.IsInit() ) if ( m_oFootnoteRef.IsInit() )
sResult += m_oInstrText->toXML(); sResult += m_oFootnoteRef->toXML();
if ( m_oLastRenderedPageBreak.IsInit() ) if ( m_oFootnoteReference.IsInit() )
sResult += m_oLastRenderedPageBreak->toXML(); sResult += m_oFootnoteReference->toXML();
if ( m_oMonthLong.IsInit() ) if ( m_oInstrText.IsInit() )
sResult += m_oMonthLong->toXML(); sResult += m_oInstrText->toXML();
if ( m_oMonthShort.IsInit() ) if ( m_oLastRenderedPageBreak.IsInit() )
sResult += m_oMonthShort->toXML(); sResult += m_oLastRenderedPageBreak->toXML();
if ( m_oNoBreakHyphen.IsInit() ) if ( m_oMonthLong.IsInit() )
sResult += m_oNoBreakHyphen->toXML(); sResult += m_oMonthLong->toXML();
if ( m_oObject.IsInit() ) if ( m_oMonthShort.IsInit() )
sResult += m_oObject->toXML(); sResult += m_oMonthShort->toXML();
if ( m_oPgNum.IsInit() ) if ( m_oNoBreakHyphen.IsInit() )
sResult += m_oPgNum->toXML(); sResult += m_oNoBreakHyphen->toXML();
if ( m_oPtab.IsInit() ) if ( m_oObject.IsInit() )
sResult += m_oPtab->toXML(); sResult += m_oObject->toXML();
if ( m_oMRPr.IsInit() ) if ( m_oPgNum.IsInit() )
sResult += m_oMRPr->toXML(); sResult += m_oPgNum->toXML();
if ( m_oRPr.IsInit() ) if ( m_oPtab.IsInit() )
sResult += m_oRPr->toXML(); sResult += m_oPtab->toXML();
if ( m_oRuby.IsInit() ) if ( m_oMRPr.IsInit() )
sResult += m_oRuby->toXML(); sResult += m_oMRPr->toXML();
if ( m_oSeparator.IsInit() ) if ( m_oRPr.IsInit() )
sResult += m_oSeparator->toXML(); sResult += m_oRPr->toXML();
if ( m_oSoftHyphen.IsInit() ) if ( m_oRuby.IsInit() )
sResult += m_oSoftHyphen->toXML(); sResult += m_oRuby->toXML();
if ( m_oSym.IsInit() ) if ( m_oSeparator.IsInit() )
sResult += m_oSym->toXML(); sResult += m_oSeparator->toXML();
if ( m_oMText.IsInit() ) if ( m_oSoftHyphen.IsInit() )
sResult += m_oMText->toXML(); sResult += m_oSoftHyphen->toXML();
if ( m_oText.IsInit() ) if ( m_oSym.IsInit() )
sResult += m_oText->toXML(); sResult += m_oSym->toXML();
if ( m_oTab.IsInit() ) if ( m_oMText.IsInit() )
sResult += m_oTab->toXML(); sResult += m_oMText->toXML();
if ( m_oYearLong.IsInit() ) if ( m_oText.IsInit() )
sResult += m_oYearLong->toXML(); sResult += m_oText->toXML();
if ( m_oYearShort.IsInit() ) if ( m_oTab.IsInit() )
sResult += m_oYearShort->toXML(); sResult += m_oTab->toXML();
sResult += _T("</m:r>");
return sResult; if ( m_oYearLong.IsInit() )
} sResult += m_oYearLong->toXML();
if ( m_oYearShort.IsInit() )
sResult += m_oYearShort->toXML();
return sResult;
}
} }
} }
\ No newline at end of file
...@@ -580,8 +580,8 @@ namespace OOX ...@@ -580,8 +580,8 @@ namespace OOX
public: public:
//Childs //Childs
nullable<OOX::Logic::CRunProperty> m_oRPr; nullable<OOX::Logic::CRunProperty> m_oRPr;
nullable<OOX::Logic::CIns> m_oIns; nullable<OOX::Logic::CRPrChange> m_oIns;
nullable<OOX::Logic::CDel> m_oDel; nullable<OOX::Logic::CRPrChange> m_oDel;
}; };
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// CDelimiterPr 22.1.2.31 (Delimiter Properties) // CDelimiterPr 22.1.2.31 (Delimiter Properties)
...@@ -2242,6 +2242,8 @@ namespace OOX ...@@ -2242,6 +2242,8 @@ namespace OOX
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
class CMText; class CMText;
class CMRPr; class CMRPr;
class CMDel;
class CMIns;
class CMRun : public WritingElement class CMRun : public WritingElement
{ {
public: public:
...@@ -2281,6 +2283,8 @@ namespace OOX ...@@ -2281,6 +2283,8 @@ namespace OOX
m_oDayLong = oReader; m_oDayLong = oReader;
else if ( _T("w:dayShort") == sName ) else if ( _T("w:dayShort") == sName )
m_oDayShort = oReader; m_oDayShort = oReader;
else if ( _T("w:del") == sName )
m_oDel = oReader;
else if ( _T("w:delInstrText") == sName ) else if ( _T("w:delInstrText") == sName )
m_oDelInstrText = oReader; m_oDelInstrText = oReader;
else if ( _T("w:delText") == sName ) else if ( _T("w:delText") == sName )
...@@ -2297,6 +2301,8 @@ namespace OOX ...@@ -2297,6 +2301,8 @@ namespace OOX
m_oFootnoteRef = oReader; m_oFootnoteRef = oReader;
else if ( _T("w:footnoteReference") == sName ) else if ( _T("w:footnoteReference") == sName )
m_oFootnoteReference = oReader; m_oFootnoteReference = oReader;
else if ( _T("w:ins") == sName )
m_oIns = oReader;
else if ( _T("w:instrText") == sName ) else if ( _T("w:instrText") == sName )
m_oInstrText = oReader; m_oInstrText = oReader;
else if ( _T("w:lastRenderedPageBreak") == sName ) else if ( _T("w:lastRenderedPageBreak") == sName )
...@@ -2338,6 +2344,7 @@ namespace OOX ...@@ -2338,6 +2344,7 @@ namespace OOX
} }
} }
virtual CString toXML() const; virtual CString toXML() const;
virtual CString toXMLInner() const;
virtual EElementType getType() const virtual EElementType getType() const
{ {
...@@ -2353,6 +2360,7 @@ namespace OOX ...@@ -2353,6 +2360,7 @@ namespace OOX
nullable<OOX::Logic::CCr> m_oCr; nullable<OOX::Logic::CCr> m_oCr;
nullable<OOX::Logic::CDayLong> m_oDayLong; nullable<OOX::Logic::CDayLong> m_oDayLong;
nullable<OOX::Logic::CDayShort> m_oDayShort; nullable<OOX::Logic::CDayShort> m_oDayShort;
nullable<OOX::Logic::CMDel> m_oDel;
nullable<OOX::Logic::CDelInstrText> m_oDelInstrText; nullable<OOX::Logic::CDelInstrText> m_oDelInstrText;
nullable<OOX::Logic::CDelText> m_oDelText; nullable<OOX::Logic::CDelText> m_oDelText;
nullable<OOX::Logic::CDrawing> m_oDrawing; nullable<OOX::Logic::CDrawing> m_oDrawing;
...@@ -2361,6 +2369,7 @@ namespace OOX ...@@ -2361,6 +2369,7 @@ namespace OOX
nullable<OOX::Logic::CFldChar> m_oFldChar; nullable<OOX::Logic::CFldChar> m_oFldChar;
nullable<OOX::Logic::CFootnoteRef> m_oFootnoteRef; nullable<OOX::Logic::CFootnoteRef> m_oFootnoteRef;
nullable<OOX::Logic::CFootnoteReference> m_oFootnoteReference; nullable<OOX::Logic::CFootnoteReference> m_oFootnoteReference;
nullable<OOX::Logic::CMIns> m_oIns;
nullable<OOX::Logic::CInstrText> m_oInstrText; nullable<OOX::Logic::CInstrText> m_oInstrText;
nullable<OOX::Logic::CLastRenderedPageBreak> m_oLastRenderedPageBreak; nullable<OOX::Logic::CLastRenderedPageBreak> m_oLastRenderedPageBreak;
nullable<OOX::Logic::CMonthLong> m_oMonthLong; nullable<OOX::Logic::CMonthLong> m_oMonthLong;
...@@ -2380,7 +2389,184 @@ namespace OOX ...@@ -2380,7 +2389,184 @@ namespace OOX
nullable<OOX::Logic::CTab> m_oTab; nullable<OOX::Logic::CTab> m_oTab;
nullable<OOX::Logic::CYearLong> m_oYearLong; nullable<OOX::Logic::CYearLong> m_oYearLong;
nullable<OOX::Logic::CYearShort> m_oYearShort; nullable<OOX::Logic::CYearShort> m_oYearShort;
}; };
class CMDel : public WritingElement
{
public:
WritingElement_AdditionConstructors(CMDel)
CMDel()
{
}
virtual ~CMDel()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
m_oRun = oReader;
}
virtual CString toXML() const
{
CString sResult;
sResult += "<w:del";
if ( m_sAuthor.IsInit() )
{
sResult += " w:author=\"";
sResult += XmlUtils::EncodeXmlString(m_sAuthor->GetString());
sResult += "\" ";
}
if ( m_oDate.IsInit() )
{
sResult += " w:date=\"";
sResult += XmlUtils::EncodeXmlString(m_oDate->ToString());
sResult += "\" ";
}
if ( m_oId.IsInit() )
{
sResult += " w:id=\"";
sResult += m_oId->ToString();
sResult += "\" ";
}
if ( m_sUserId.IsInit() )
{
sResult += " oouserid=\"";
sResult += XmlUtils::EncodeXmlString(m_sUserId->GetString());
sResult += "\" ";
}
sResult += ">";
if(m_oRun.IsInit())
{
sResult += m_oRun->toXMLInner();
}
sResult += "</w:del>";
return sResult;
}
virtual EElementType getType() const
{
return et_w_ins;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_sAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_sAuthor;
nullable<SimpleTypes::CDateTime > m_oDate;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
nullable<CString > m_sUserId;
// Childs
nullable<CMRun> m_oRun;
};
class CMIns : public WritingElement
{
public:
WritingElement_AdditionConstructors(CMIns)
CMIns()
{
}
virtual ~CMIns()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
m_oRun = oReader;
}
virtual CString toXML() const
{
CString sResult;
sResult += "<w:ins";
if ( m_sAuthor.IsInit() )
{
sResult += " w:author=\"";
sResult += XmlUtils::EncodeXmlString(m_sAuthor->GetString());
sResult += "\" ";
}
if ( m_oDate.IsInit() )
{
sResult += " w:date=\"";
sResult += XmlUtils::EncodeXmlString(m_oDate->ToString());
sResult += "\" ";
}
if ( m_oId.IsInit() )
{
sResult += " w:id=\"";
sResult += m_oId->ToString();
sResult += "\" ";
}
if ( m_sUserId.IsInit() )
{
sResult += " oouserid=\"";
sResult += XmlUtils::EncodeXmlString(m_sUserId->GetString());
sResult += "\" ";
}
sResult += ">";
if(m_oRun.IsInit())
{
sResult += m_oRun->toXMLInner();
}
sResult += "</w:ins>";
return sResult;
}
virtual EElementType getType() const
{
return et_w_ins;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_sAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_sAuthor;
nullable<SimpleTypes::CDateTime > m_oDate;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
nullable<CString > m_sUserId;
// Childs
nullable<CMRun> m_oRun;
};
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// CRad 22.1.2.88 (Radical Object) // CRad 22.1.2.88 (Radical Object)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
......
#pragma once #pragma once
//#include "NamespaceOwn.h" //#include "NamespaceOwn.h"
#include "../XML/xmlutils.h" #include "../XML/xmlutils.h"
...@@ -44,7 +44,7 @@ namespace OOX ...@@ -44,7 +44,7 @@ namespace OOX
if ( oValue.IsInit() )\ if ( oValue.IsInit() )\
sResult += oValue->toXML(); sResult += oValue->toXML();
// 3 define CXmlLiteReader // Следующие 3 define используются для чтения аттрибутов через CXmlLiteReader
#define WritingElement_ReadAttributes_Start(Reader) \ #define WritingElement_ReadAttributes_Start(Reader) \
if ( Reader.GetAttributesCount() <= 0 )\ if ( Reader.GetAttributesCount() <= 0 )\
return;\ return;\
......
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