Commit 98c9f22b authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander Trofimov

(2.0.0.188): ASCOfficeDocxFile2

1) сброс текстовых настроек для чтения у формул
2) поправлен баг, когда отсутствуют настройки для матрицы в формулах

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58722 954022d7-b5bf-4e40-9824-e11837661b57
parent d38f58fb
......@@ -2650,7 +2650,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
m_oFileWriter.m_oSettingWriter.AddSetting(sVal);
}
else
......@@ -3251,7 +3251,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3268,7 +3268,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3622,6 +3622,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSerRunType::rPr == type )
{
m_oMath_rPr.Reset();
res = oBinary_rPrReader.Read(length, &m_oMath_rPr);
if(m_oMath_rPr.IsNoEmpty())
m_oMath_rPr.Write(&GetRunStringWriter());
......@@ -3659,7 +3660,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3676,7 +3677,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3941,7 +3942,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3958,7 +3959,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3975,7 +3976,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -3992,7 +3993,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4128,7 +4129,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4164,7 +4165,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4242,6 +4243,10 @@ public:
{
res = Read2(length, &Binary_DocumentTableReader::ReadMathLong, this, poResult);
}
else if ( c_oSer_OMathBottomNodesType::Column == type )
{
res = Read2(length, &Binary_DocumentTableReader::ReadMathLong, this, poResult);
}
else if ( c_oSer_OMathBottomNodesType::BaseJc == type )
{
res = Read2(length, &Binary_DocumentTableReader::ReadMathBaseJc, this, poResult);
......@@ -4373,7 +4378,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4390,7 +4395,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4407,7 +4412,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4454,7 +4459,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4523,7 +4528,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4571,6 +4576,7 @@ public:
}
else if ( c_oSer_OMathContentType::RPr == type )
{
m_oMath_rPr.Reset();
res = oBinary_rPrReader.Read(length, &m_oMath_rPr);
if(m_oMath_rPr.IsNoEmpty())
m_oMath_rPr.Write(&GetRunStringWriter());
......@@ -4753,7 +4759,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4958,7 +4964,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4975,7 +4981,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -4992,7 +4998,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5009,7 +5015,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5048,7 +5054,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5065,7 +5071,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5082,7 +5088,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5141,7 +5147,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5158,7 +5164,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......@@ -5175,7 +5181,7 @@ public:
if (bVal)
sVal += _T(" m:val=\"true\" />");
else
sVal += _T(" />");
sVal += _T(" m:val=\"false\" />");
GetRunStringWriter().WriteString(sVal);
}
else
......
......@@ -27,6 +27,8 @@ namespace MathEquation
std::stack<int> m_aLimitElemsStack;
std::stack<int> m_aScriptStack;
std::stack<int> m_aAccentStack;
std::stack<int> m_aRowsCounter;
std::stack<int> m_aRowsPosCounter;
LONG nTextSize;
LONG nCtrlSize;
......@@ -197,25 +199,25 @@ namespace MathEquation
CString str;
switch (eType)
{
/*case embelDot: str.Insert(0," dot "); break;
case embelDDot: str.Insert(0," ddot "); break;
case embelDDDot: str.Insert(0," dddot "); break;
case embelPrime: str.Insert(0," prime "); break;
case embelDPrime: str.Insert(0," double prime "); break;
case embelLPrime: str.Insert(0," left prime "); break;
case embelTilde: str.Insert(0," tilde "); break;
case embelHat: str.Insert(0," hat "); break;
case embelSlash: str.Insert(0," slash "); break;
case embelLArrow: str.Insert(0," left arrow "); break;
case embelRArrow: str.Insert(0," right arrow "); break;*/
case embelDot: str.Insert(0, 0x0307); break;
case embelDDot: str.Insert(0, 0x0308); break;
case embelDDDot: str.Insert(0, 0x20DB); break;
case embelPrime: str.Insert(0, 0x2032); break;
case embelDPrime: str.Insert(0, 0x2033); break;
case embelLPrime: str.Insert(0, 0x0300); break;
case embelTilde: str.Insert(0, 0x007E); break;
case embelHat: str.Insert(0, 0x005E); break;
case embelSlash: str.Insert(0, 0x002F); break;
case embelLArrow: str.Insert(0, 0x2190); break;
case embelRArrow: str.Insert(0, 0x2192); break;
case embelDArrow: str.Insert(0, 0x2194); break;
/*case embelLHarpoon: str.Insert(0," left harpoon "); break;
case embelRHarpoon: str.Insert(0," right harpoon "); break;
case embelStrikeout: str.Insert(0," strikeout "); break;
case embelBar: str.Insert(0," bar "); break;
case embelTPrime: str.Insert(0," triple prime "); break;
case embelFrown: str.Insert(0," frown "); break;
case embelSmile: str.Insert(0," smiple "); break;*/
case embelLHarpoon: str.Insert(0, 0x21BC); break;
case embelRHarpoon: str.Insert(0, 0x21C0); break;
case embelStrikeout: str.Insert(0, 0x0336); break;
case embelBar: str.Insert(0, 0x0305); break;
case embelTPrime: str.Insert(0, 0x2034); break;
case embelFrown: str.Insert(0, 0x23DD); break;
case embelSmile: str.Insert(0, 0x23DC); break;
}
WriteItemValStr(BinDocxRW::c_oSer_OMathBottomNodesType::Chr, str);
WriteItemEnd(nCurPos1);
......@@ -302,6 +304,16 @@ namespace MathEquation
CBaseCommand* pCommand = TopCommand();
pCommand->WriteEndBlock(this);
int nRows = m_aRowsCounter.top();
int nPos = m_aRowsPosCounter.top();
m_aRowsCounter.pop();
m_aRowsPosCounter.pop();
int nEnd = m_oStream.GetPosition();
m_oStream.SetPosition(nPos);
m_oStream.WriteLONG(nRows);
m_oStream.SetPosition(nEnd);
ECommandType type;
type = pCommand->GetCommand();
if (type == commandIntegral || type == commandNArray)
......@@ -750,6 +762,7 @@ namespace MathEquation
int nCurPos2 = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::Element);
m_aLimitStack.push(nCurPos2);
int nCurPos3 = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::GroupChr);
int nCurPos4 = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::GroupChrPr);
......@@ -764,6 +777,7 @@ namespace MathEquation
WriteItemEnd(nCurPos3);
WriteItemEnd(nCurPos2);
}
virtual void EndVerticalBrace ()
{
......@@ -1031,7 +1045,8 @@ namespace MathEquation
commandVerticalBrace = 0x08,
commandNArray = 0x09,
commandLongDivision = 0x0a,
commandBracketsSep = 0x0b
commandBracketsSep = 0x0b,
commandVerticalBraceLim = 0x0c
};
class CBaseCommand
......@@ -1076,7 +1091,10 @@ namespace MathEquation
{
int nElemPos;
if (bEqArrayStart)
{
nElemPos = pWriter->WriteItemStart(BinDocxRW::c_oSer_OMathContentType::Element);
nRows++;
}
else
nElemPos = pWriter->WriteItemStart(elem);
m_aBaseStack.push(nElemPos);
......@@ -1087,10 +1105,20 @@ namespace MathEquation
nElemPos = pWriter->WriteItemStart(BinDocxRW::c_oSer_OMathContentType::EqArr);
m_aBaseStack.push(nElemPos);
nElemPos = pWriter->WriteItemStart(BinDocxRW::c_oSer_OMathContentType::EqArrPr);
int nCurPos1 = pWriter->WriteItemStart(BinDocxRW::c_oSer_OMathBottomNodesType::Row);
pWriter->m_oStream.WriteBYTE(BinDocxRW::c_oSer_OMathBottomNodesValType::Val);
pWriter->m_oStream.WriteBYTE(BinDocxRW::c_oSerPropLenType::Long);
pWriter->m_aRowsPosCounter.push( pWriter->WriteItemWithLengthStart());
pWriter->WriteItemEnd(nCurPos1);
pWriter->WriteItemEnd(nElemPos);
nElemPos = pWriter->WriteItemStart(BinDocxRW::c_oSer_OMathContentType::Element);
nRows = 1;
m_aBaseStack.push(nElemPos);
}
}
......@@ -1110,6 +1138,7 @@ namespace MathEquation
pWriter->WriteItemEnd(nCurPos);
else if (!bPile && bEqArrayStart)
{
pWriter->m_aRowsCounter.push(nRows);
bEqArrayStart = false;
pWriter->WriteItemEnd(nCurPos);//eqArr
......@@ -1127,6 +1156,7 @@ namespace MathEquation
virtual void WriteEndBlock(BinaryEquationWriter* pWriter) = 0;
protected:
int nRows;
std::stack<int> m_aBaseStack;
BOOL bOpenNode;
BOOL bPile;
......@@ -1533,19 +1563,70 @@ namespace MathEquation
virtual ECommandType GetCommand(){return commandVerticalBrace;}
virtual void WriteBeginBlock(BinaryEquationWriter* pWriter)
{
Write(pWriter, true);
}
virtual void WriteEndBlock(BinaryEquationWriter* pWriter)
{
Write(pWriter, false);
}
void Write(BinaryEquationWriter* pWriter, bool bBeginNode)
{
if (0 == nBlockNum)
pWriter->WriteNodeBegin("base");
{
if (bBeginNode)
WriteBeginNode(pWriter, BinDocxRW::c_oSer_OMathContentType::Element);
else
pWriter->WriteNodeBegin("brace-base");
{
WriteEndNode(pWriter);
/*if (!pWriter->m_aCommandStack.empty())
{
CBaseCommand* pCommand = pWriter->TopCommand();
pCommand->WriteEndBlock(pWriter);
}*/
pWriter->PopCommand();
int nCurPos = pWriter->m_aLimitStack.top();
pWriter->WriteItemEnd(nCurPos);
pWriter->PushCommand(commandVerticalBraceLim);
CBaseCommand* pCommand = pWriter->TopCommand();
pCommand->Next();
pCommand->WriteBeginBlock(pWriter);
}
}
}
private:
int nBasePos;
int nBraceBasePos;
};
class CVerticalBraceLimCommand : public CBaseCommand
{
public:
CVerticalBraceLimCommand() {}
virtual ~CVerticalBraceLimCommand() {}
virtual ECommandType GetCommand(){return commandVerticalBraceLim;}
virtual void WriteBeginBlock(BinaryEquationWriter* pWriter)
{
Write(pWriter, true);
}
virtual void WriteEndBlock(BinaryEquationWriter* pWriter)
{
Write(pWriter, false);
}
void Write(BinaryEquationWriter* pWriter, bool bBeginNode)
{
if (0 == nBlockNum)
pWriter->WriteNodeEnd("base");
{
if (bBeginNode)
WriteBeginNode(pWriter, BinDocxRW::c_oSer_OMathContentType::Lim);
else
pWriter->WriteNodeEnd("brace-base");
WriteEndNode(pWriter);
}
}
private:
int nBasePos;
......@@ -1697,6 +1778,7 @@ namespace MathEquation
case commandArrow: pCommand = new CArrowCommand(); break;
case commandIntegral: pCommand = new CIntegralCommand(); break;
case commandVerticalBrace: pCommand = new CVerticalBraceCommand(); break;
case commandVerticalBraceLim: pCommand = new CVerticalBraceLimCommand(); break;
case commandNArray: pCommand = new CNArrayCommand(); break;
case commandLongDivision: pCommand = new CLongDivisionCommand(); break;
case commandBracketsSep: pCommand = new CBracketsWithSeparatorCommand(); break;
......
......@@ -3047,7 +3047,18 @@ namespace BinDocxRW
OOX::Logic::CMatrix* pMatrix = static_cast<OOX::Logic::CMatrix*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::Matrix);
WriteMathMatrix(pMatrix->m_arrItems, pMatrix->m_lRow);
LONG lCol = 0;
for ( int j = 0; j < pMatrix->m_arrItems.size(); j++)
{
OOX::WritingElement* item = pMatrix->m_arrItems[j];
if (item->getType() == OOX::et_m_mr)
{
OOX::Logic::CMr* pMr = static_cast<OOX::Logic::CMr*>(item);
lCol = pMr->GetCol();
break;
}
}
WriteMathMatrix(pMatrix->m_arrItems, pMatrix->m_lRow, lCol);
m_oBcw.WriteItemEnd(nCurPos);
break;
}
......@@ -3773,7 +3784,7 @@ namespace BinDocxRW
}
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteMathMatrix(const std::vector<OOX::WritingElement*>& m_arrItems, LONG &lRow)
void WriteMathMatrix(const std::vector<OOX::WritingElement*>& m_arrItems, LONG &lRow, LONG &lCol)
{
BOOL bColumn = false;
for(int i = 0; i< m_arrItems.size(); ++i)
......@@ -3790,6 +3801,8 @@ namespace BinDocxRW
if (lRow)
WriteMathRow(lRow);
if (lCol)
WriteMathColumn(lCol);
if ( pMPr->m_oBaseJc.IsInit() )
WriteMathBaseJc(pMPr->m_oBaseJc.get());
if ( pMPr->m_oCGp.IsInit() )
......
......@@ -2,6 +2,6 @@
//2
//0
//0
//187
#define INTVER 2,0,0,187
#define STRVER "2,0,0,187\0"
//188
#define INTVER 2,0,0,188
#define STRVER "2,0,0,188\0"
......@@ -517,6 +517,7 @@ namespace SimpleTypes
virtual ETopBot FromString(CString &sValue)
{
if ( _T("bot") == sValue ) this->m_eValue = tbBot;
else if ( _T("bottom") == sValue ) this->m_eValue = tbBot;
else this->m_eValue = tbTop;
return this->m_eValue;
......
......@@ -854,6 +854,7 @@ namespace SimpleTypes
virtual EYAlign FromString(CString &sValue)
{
if ( _T("bottom") == sValue ) this->m_eValue = yalignBottom;
else if ( _T("bot") == sValue ) this->m_eValue = yalignBottom;
else if ( _T("center") == sValue ) this->m_eValue = yalignCenter;
else if ( _T("inline") == sValue ) this->m_eValue = yalignInline;
else if ( _T("inside") == sValue ) this->m_eValue = yalignInside;
......
......@@ -1804,6 +1804,8 @@ namespace OOX
if ( oReader.IsEmptyNode() )
return;
m_lCol = 0;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
......@@ -1811,7 +1813,10 @@ namespace OOX
WritingElement *pItem = NULL;
if ( _T("m:e") == sName )
{
pItem = new Logic::CElement( oReader );
m_lCol++;
}
if ( pItem )
m_arrItems.push_back( pItem );
......@@ -1838,8 +1843,13 @@ namespace OOX
{
return et_m_mr;
}
LONG GetCol()
{
return m_lCol;
}
public:
// Childs
LONG m_lCol;
};
//--------------------------------------------------------------------------------
// CMatrix 22.1.2.60 (Matrix Object)
......
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