Commit 0954cf3b authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander Trofimov
parent 06ea0746
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "BinReaderWriterDefines.h" #include "BinReaderWriterDefines.h"
#include "../../Common/DocxFormat/Source/MathEquation/OutputDev.h" #include "../../Common/DocxFormat/Source/MathEquation/OutputDev.h"
//#include "String.h"
#include <stack> #include <stack>
/*namespace BinDocxRW /*namespace BinDocxRW
...@@ -21,10 +20,12 @@ namespace MathEquation ...@@ -21,10 +20,12 @@ namespace MathEquation
bool bAccent; bool bAccent;
MEMBELTYPE eType; MEMBELTYPE eType;
BYTE eStyle; BYTE eStyle;
bool bNormal;
public: public:
EquationRun() EquationRun()
{ {
bNormal = false;
eStyle = NULL; eStyle = NULL;
} }
void AddChar(CString sChar, TMathFont* pNewFont, LONG lSize) void AddChar(CString sChar, TMathFont* pNewFont, LONG lSize)
...@@ -60,10 +61,24 @@ namespace MathEquation ...@@ -60,10 +61,24 @@ namespace MathEquation
{ {
private: private:
TMathFont* oCurFont; TMathFont* oCurFont;
std::vector<EquationRun> arrRun; std::vector<EquationRun> arrRun;
public: public:
RunManager()
{
bAlligment = false;
}
void SetAlligment(bool bPos)
{
bAlligment = bPos;
return;
}
bool GetAlligment()
{
return bAlligment;
}
void Add(EquationRun oElem) void Add(EquationRun oElem)
{ {
arrRun.push_back(oElem); arrRun.push_back(oElem);
return; return;
} }
...@@ -109,6 +124,8 @@ namespace MathEquation ...@@ -109,6 +124,8 @@ namespace MathEquation
oRun.eType = eType; oRun.eType = eType;
Add(oRun); Add(oRun);
} }
public:
bool bAlligment;
}; };
class BinaryEquationWriter : public IOutputDev class BinaryEquationWriter : public IOutputDev
...@@ -198,7 +215,10 @@ namespace MathEquation ...@@ -198,7 +215,10 @@ namespace MathEquation
{ {
int nCurPos = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::MRPr); int nCurPos = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::MRPr);
WriteItemVal(BinDocxRW::c_oSer_OMathBottomNodesType::Sty, oRun.eStyle); if (oRun.eStyle)
WriteItemVal(BinDocxRW::c_oSer_OMathBottomNodesType::Sty, oRun.eStyle);
if (oRun.bNormal)
WriteItemVal(BinDocxRW::c_oSer_OMathBottomNodesType::Nor, oRun.bNormal);
WriteItemEnd(nCurPos); WriteItemEnd(nCurPos);
return; return;
} }
...@@ -208,7 +228,7 @@ namespace MathEquation ...@@ -208,7 +228,7 @@ namespace MathEquation
TMathFont* pCurFont = oRun.pFont; TMathFont* pCurFont = oRun.pFont;
int nCurPos = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::MRun); int nCurPos = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::MRun);
WriteRPR(oRun.pFont, oRun.nTextSize, bIsOpen); WriteRPR(oRun.pFont, oRun.nTextSize, bIsOpen);
if (oRun.eStyle) if (oRun.eStyle || oRun.bNormal)
WriteMRPR(oRun); WriteMRPR(oRun);
int nCurPos1 = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::MText); int nCurPos1 = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::MText);
m_oStream.WriteBYTE(BinDocxRW::c_oSer_OMathBottomNodesValType::Val); m_oStream.WriteBYTE(BinDocxRW::c_oSer_OMathBottomNodesValType::Val);
...@@ -336,6 +356,7 @@ namespace MathEquation ...@@ -336,6 +356,7 @@ namespace MathEquation
} }
oRManager.Delete(0,lSize); oRManager.Delete(0,lSize);
} }
oRManager.SetAlligment(false);
return; return;
} }
...@@ -423,12 +444,20 @@ namespace MathEquation ...@@ -423,12 +444,20 @@ namespace MathEquation
{ {
switch(uChar) switch(uChar)
{ {
case specialsymAlignment: str.Insert(0,0x0089); break; case specialsymAlignment:
{
str.Insert(0, 0x0026);
if (oRManager.GetAlligment())
oRun.bNormal = true;
else
oRManager.SetAlligment(true);
}
break;
case specialsymZeroSpace: str.Insert(0,0x200B); break; case specialsymZeroSpace: str.Insert(0,0x200B); break;
case specialsymThinSpace: str.Insert(0,0x2009); break; break; case specialsymThinSpace: str.Insert(0,0x2009); break;
case specialsymThickSpace: str.Insert(0,0x2004); break; case specialsymThickSpace: str.Insert(0,0x2005); break;
case specialsymLargeSpace: str.Insert(0,0x2005); break; case specialsymLargeSpace: str.Insert(0,0x2003); break;
case specialsymOnePtSpace: str.Insert(0,0x2003); break; case specialsymOnePtSpace: str.Insert(0,0x200A); break;
} }
} }
else else
...@@ -436,6 +465,13 @@ namespace MathEquation ...@@ -436,6 +465,13 @@ namespace MathEquation
if ((uChar > 0x0390 && uChar < 0x03AA) //Greek Capital Letter if ((uChar > 0x0390 && uChar < 0x03AA) //Greek Capital Letter
|| (uChar == 0x2207)) //Nabla || (uChar == 0x2207)) //Nabla
oRun.eStyle = SimpleTypes::stylePlain; oRun.eStyle = SimpleTypes::stylePlain;
else if (uChar == 0x0026)
{
if (oRManager.GetAlligment())
oRun.bNormal = true;
else
oRManager.SetAlligment(true);
}
else if (uChar == 0x03C6) else if (uChar == 0x03C6)
uChar = 0x03D5; uChar = 0x03D5;
else if (uChar == 0x03D5) else if (uChar == 0x03D5)
...@@ -551,11 +587,18 @@ namespace MathEquation ...@@ -551,11 +587,18 @@ namespace MathEquation
CBaseCommand* pCommand = TopCommand(); CBaseCommand* pCommand = TopCommand();
pCommand->WriteEndBlock(this); pCommand->WriteEndBlock(this);
int nRows = m_aRowsCounter.top(); int nRows = 0;
int nPos = m_aRowsPosCounter.top(); if (!m_aRowsCounter.empty())
m_aRowsCounter.pop(); {
m_aRowsPosCounter.pop(); nRows = m_aRowsCounter.top();
m_aRowsCounter.pop();
}
int nPos = 0;
if (!m_aRowsPosCounter.empty())
{
nRows = m_aRowsPosCounter.top();
m_aRowsPosCounter.pop();
}
int nEnd = m_oStream.GetPosition(); int nEnd = m_oStream.GetPosition();
m_oStream.SetPosition(nPos); m_oStream.SetPosition(nPos);
m_oStream.WriteLONG(nRows); m_oStream.WriteLONG(nRows);
...@@ -1505,7 +1548,7 @@ namespace MathEquation ...@@ -1505,7 +1548,7 @@ namespace MathEquation
{ {
bool bCurPile; bool bCurPile;
bCurPile = GetPile(); bCurPile = GetPile();
if (!bCurPile || (nBlockNum == -1)) if (!bCurPile || (nBlockNum == -1))
nBlockNum++; nBlockNum++;
} }
......
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