Commit 146c5c07 authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander Trofimov

(2.0.0.244): ASCOfficeDocxFile2

Для степеней в формулах переделан порядок записи. теперь всегда сперва записываются степени, а в конце база
Переделан run для старых формул. Теперь элементы записываются перед началом нового тега.
В ноде oMathPara добевлен <w:r> которого нет в документации

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59850 954022d7-b5bf-4e40-9824-e11837661b57
parent 5ac5a547
......@@ -4434,6 +4434,13 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadMathOMathParaPr, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:oMathParaPr>")));
}
else if ( c_oSer_OMathContentType::Run == type )
{
m_oCur_rPr.Reset();
GetRunStringWriter().WriteString(CString(_T("<w:r>")));
res = Read1(length, &Binary_DocumentTableReader::ReadRun, this, NULL);
GetRunStringWriter().WriteString(CString(_T("</w:r>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -4562,16 +4569,25 @@ public:
CString strVal(m_oBufferedStream.GetString3(length));
return XmlUtils::EncodeXmlString(strVal, true);
}
int ReadMathText(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
CString sText = GetMathText (length);
GetRunStringWriter().WriteString(sText);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadMathMRun(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathContentType::MText == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:t>")));
CString sText = GetMathText (length);
GetRunStringWriter().WriteString(sText);
res = Read2(length, &Binary_DocumentTableReader::ReadMathText, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:t>")));
}
else if ( c_oSer_OMathContentType::RPr == type )
......@@ -4789,13 +4805,7 @@ public:
int ReadMathSPre(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else if ( c_oSer_OMathContentType::SPrePr == type )
if ( c_oSer_OMathContentType::SPrePr == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:sPrePr>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathSPrePr, this, poResult);
......@@ -4813,6 +4823,12 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:sup>")));
}
else if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -4833,13 +4849,7 @@ public:
int ReadMathSSub(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else if ( c_oSer_OMathContentType::SSubPr == type )
if ( c_oSer_OMathContentType::SSubPr == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:sSubPr>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathSSubPr, this, poResult);
......@@ -4851,6 +4861,12 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:sub>")));
}
else if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -4871,13 +4887,7 @@ public:
int ReadMathSSubSup(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else if ( c_oSer_OMathContentType::SSubSupPr == type )
if ( c_oSer_OMathContentType::SSubSupPr == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:sSubSupPr>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathSSubSupPr, this, poResult);
......@@ -4895,6 +4905,12 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:sup>")));
}
else if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -4919,13 +4935,7 @@ public:
int ReadMathSSup(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else if ( c_oSer_OMathContentType::SSupPr == type )
if ( c_oSer_OMathContentType::SSupPr == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:sSupPr>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathSSupPr, this, poResult);
......@@ -4937,6 +4947,12 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:sup>")));
}
else if ( c_oSer_OMathContentType::Element == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:e>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:e>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -5348,10 +5364,27 @@ public:
}
}
}
else if ( c_oSerRunType::object == type)
{
res = Read1(length, &Binary_DocumentTableReader::ReadObject, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
};
int ReadObject(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if( c_oSerParType::OMath == type )
{
GetRunStringWriter().WriteString(CString(_T("<m:oMath>")));
res = Read1(length, &Binary_DocumentTableReader::ReadMathArg, this, poResult);
GetRunStringWriter().WriteString(CString(_T("</m:oMath>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadComment(BYTE type, long length, void* poResult)
{
long* pVal = static_cast<long*>(poResult);
......
......@@ -767,7 +767,8 @@ extern int g_nCurFormatVersion;
MText = 57,
CtrlPr = 58,
pagebreak = 59,
linebreak = 60
linebreak = 60,
Run = 61
};}
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
{
......
......@@ -2675,7 +2675,8 @@ namespace BinDocxRW
case OOX::et_w_r:
{
OOX::Logic::CRun* pRun = static_cast<OOX::Logic::CRun*>(item);
WriteRun(pRun->m_arrItems, bHyperlink);
bool bMathRun = false;
WriteRun(pRun->m_arrItems, bHyperlink, bMathRun);
break;
}
case OOX::et_w_sdt:
......@@ -2847,7 +2848,7 @@ namespace BinDocxRW
}
return oCur_rPr;
}
void WriteRun(std::vector<OOX::WritingElement*>& m_arrItems, bool bHyperlink = false)
void WriteRun(std::vector<OOX::WritingElement*>& m_arrItems, bool bHyperlink = false, bool bMathRun = false)
{
int nCurPos = 0;
int nIndexStart = 0;
......@@ -2874,7 +2875,10 @@ namespace BinDocxRW
}
if(nIndexStart < nLength)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Run);
if (bMathRun)
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::Run);
else
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Run);
WritePreparedRun(m_arrItems, bHyperlink, nIndexStart, nLength);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
......@@ -4058,6 +4062,13 @@ namespace BinDocxRW
WriteMathMJc(pOMathParaPr->m_oMJc.get());
m_oBcw.WriteItemEnd(nCurPos);
}
else if (eType == OOX::et_w_r)
{
bool bHyperlink = false;
bool bMathRun = true;
OOX::Logic::CRun* pRun = static_cast<OOX::Logic::CRun*>(item);
WriteRun(pRun->m_arrItems, bHyperlink, bMathRun);
}
}
}
void WriteMathOMathParaPr(const OOX::Logic::COMathParaPr &pOMathParaPr)
......@@ -4349,8 +4360,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::MText);
if(!pMText.m_sText.IsEmpty())
{
CString* pStringC = const_cast<CString*>(&pMText.m_sText);
m_oBcw.m_oStream.WriteStringW(*pStringC);
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
m_oBcw.m_oStream.WriteStringW(pMText.m_sText);
}
m_oBcw.WriteItemEnd(nCurPos);
}
......
......@@ -2,6 +2,6 @@
//2
//0
//0
//243
#define INTVER 2,0,0,243
#define STRVER "2,0,0,243\0"
//244
#define INTVER 2,0,0,244
#define STRVER "2,0,0,244\0"
......@@ -2209,7 +2209,7 @@ namespace OOX
if ( m_oZeroWid.IsInit() )
sResult += m_oZeroWid->toXML();
sResult += _T("</m:oMathPara>");
sResult += _T("</m:phantPr>");
return sResult;
}
......
#pragma once
#include "oMathContent.h"
#include "../Logic/Run.h"
namespace OOX
{
......@@ -40,6 +41,8 @@ namespace OOX
pItem = new COMath( oReader );
else if ( _T("m:oMathParaPr") == sName )
pItem = new COMathParaPr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
if ( pItem )
m_arrItems.push_back( pItem );
......
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